11 #ifndef __CH_ChannelRef__
12 #define __CH_ChannelRef__
34 myNodeId = other.myNodeId;
35 myIsTrack = other.myIsTrack;
36 myName = other.myName;
37 myExternalCollectionName = other.myExternalCollectionName;
42 setChannelRef(node_id, name, is_track);
55 void setChannelRef(
int node_id,
const char *
name,
bool is_track);
57 void setExternalChannelRef(
const char *
name,
66 const char *
getName()
const {
return myName; }
68 bool isTrack()
const {
return myIsTrack; }
70 bool isGeometry()
const;
73 {
return myExternalCollectionName; }
77 return myNodeId == other.myNodeId &&
78 myIsTrack == other.myIsTrack &&
79 myName == other.myName &&
80 myExternalCollectionName == other.myExternalCollectionName;
86 setExternalChannelRef(other.myName, other.myExternalCollectionName);
88 setChannelRef(other.myNodeId, other.myName, other.myIsTrack);
94 if (myNodeId < other.myNodeId)
100 && myExternalCollectionName
101 != other.myExternalCollectionName)
103 return myExternalCollectionName
104 < other.myExternalCollectionName;
107 if (myNodeId == other.myNodeId &&
108 isLess(myName, other.myName))
115 if (myNodeId > other.myNodeId)
121 && myExternalCollectionName
122 != other.myExternalCollectionName)
124 return myExternalCollectionName
125 > other.myExternalCollectionName;
128 if (myNodeId == other.myNodeId &&
129 isGreater(myName, other.myName))
143 unsigned int hash()
const;
146 bool isLess(
const char *str1,
const char *str2)
const
151 if( str2 ) rval =
true;
156 if( !str2) rval =
false;
157 else rval = (strcmp(str1, str2) < 0) ?
true :
false;
161 bool isGreater(
const char *str1,
const char *str2)
const
164 if( !str1 ) rval =
false;
167 if( !str2 ) rval =
true;
168 else rval = (strcmp(str1, str2) > 0) ?
true :
false;
174 unsigned myIsTrack:1;
203 CH_ChannelRefTable &ref_table,
210 const CH_ChannelRefTable &
table,
216 const CH_ChannelRefTable &
table,
221 const CH_ChannelRefTable &
table,
237 CH_API extern std::ostream &
void setNodeId(int new_id)
int compare(const CH_ChannelRef &other) const
CH_API std::ostream & operator<<(std::ostream &os, const CH_ChannelRef &ref)
UT_Map< CH_ChannelRef, unsigned > CH_ChannelRefTable
CH_API void CHaddExposedChannel(const CH_ChannelRefTable &table, CH_ChannelList &channels)
CH_API bool CHchannelsToChanRefs(const CH_ChannelList &channels, CH_ChannelRefList &refs)
CH_ChannelRef & operator=(const CH_ChannelRef &other)
CH_ChannelRef(int node_id, const char *name, bool is_track)
bool operator<(const CH_ChannelRef &other) const
CH_API bool CHchanRefsToChannels(const CH_ChannelRefList &refs, CH_ChannelList &channels)
CH_API void CHaddFullChannelPath(const CH_ChannelRefTable &table, UT_StringArray &chan_paths, bool use_alias)
CH_API void CHaddExposedChanRef(const CH_ChannelRefTable &table, CH_ChannelRefList &chanrefs, unsigned mask)
UT_StringHolder getExternalCollectionName() const
GLuint const GLchar * name
std::function< T > UT_Function
GLenum GLenum GLsizei void * table
unsigned int hash() const
UT_Function< bool(const CH_ChannelRef &, unsigned flags)> CH_ChannelRefQueryCallback
CH_API int CHcompareChanRefs(const CH_ChannelRef *, const CH_ChannelRef *)
CH_ChannelRef(const CH_ChannelRef &other)
CH_API size_t format(char *buffer, size_t buffer_size, const CH_ChannelRef &v)
bool operator==(const CH_ChannelRef &other) const
bool operator>(const CH_ChannelRef &other) const
CH_API int CHdeleteRefsWithNodeId(CH_ChannelRefTable &ref_table, int node_id, const CH_ChannelRefQueryCallback &should_delete_callback=nullptr, const CH_ChannelRefCallback &pre_delete_callback=nullptr)
CH_API void CHdisplayChanRefs(const CH_ChannelRefList &refs)
size_t hash_value(const CH_ChannelRef &ref)
UT_Function< void(const CH_ChannelRef &)> CH_ChannelRefCallback
const char * getName() const
ImageBuf OIIO_API channels(const ImageBuf &src, int nchannels, cspan< int > channelorder, cspan< float > channelvalues={}, cspan< std::string > newchannelnames={}, bool shuffle_channel_names=false, int nthreads=0)