HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
CH_MultiChannel.h
Go to the documentation of this file.
1 /*
2  * PROPRIETARY INFORMATION. This software is proprietary to
3  * Side Effects Software Inc., and is not to be reproduced,
4  * transmitted, or disclosed in any way without written permission.
5  *
6  * NAME: CH_MultiChannel.h (UI library, C++)
7  *
8  * COMMENTS: Manages an array of arbitary channels to act as a single one.
9  * This is meant to be a lightweight collection of channels that
10  * may belong to an arbitrary list of CH_Collection's. Ownership
11  * of the pointers are NOT assumed.
12  *
13  */
14 
15 #ifndef __CH_MultiChannel_h__
16 #define __CH_MultiChannel_h__
17 
18 #include "CH_API.h"
19 #include "CH_Types.h"
20 #include <UT/UT_String.h>
21 #include <SYS/SYS_Types.h>
22 
23 class CH_Channel;
24 class CH_Manager;
25 
27 {
28 public:
30  explicit CH_MultiChannel(const char *name);
31  virtual ~CH_MultiChannel();
32 
35  const CH_MultiChannel &copy);
36 
37  const UT_String & getName() const
38  { return myName; }
39  void setName(const UT_String &name)
40  { myName.harden(name); }
41  void appendChannelNames(const char *separator);
42 
43  void clear()
44  { myChannels.entries(); }
45  void append(CH_Channel *channel);
46 
48  { return myChannels; }
49 
50  int getNumChannels() const
51  { return myChannels.entries(); }
52 
53  void removeChannel(int i)
54  { myChannels.removeIndex((unsigned)i); }
55 
56  void addToList(CH_ChannelList &channels) const;
57 
58  bool isEmpty() const
59  { return myChannels.entries() == 0; }
60  bool isAllEnabled() const;
61  bool hasKeys() const;
62 
63  fpreal getStart() const;
64  fpreal getEnd() const;
65  fpreal getLength() const;
66 
67  bool isAtHardKey(fpreal gtime) const;
68  bool isAtHardKeyframe(int frame) const;
69  fpreal findKey(fpreal gtime, int direction) const;
70  int findKeyframe(int frame, int direction) const;
71 
72  void scroll(fpreal new_start, int update = 1);
73 
74 private:
75  // do not use!
76  int operator==(const CH_MultiChannel &) const
77  { return 0; }
78 
79 protected:
80  // only subclasses can modify the array!
82  { return myChannels; }
83 
84 private:
85  UT_String myName;
86  CH_ChannelList myChannels;
87 };
88 
89 #endif // __CH_MultiChannel_h__
90 
OIIO_UTIL_API bool copy(string_view from, string_view to, std::string &err)
IMF_EXPORT IMATH_NAMESPACE::V3f direction(const IMATH_NAMESPACE::Box2i &dataWindow, const IMATH_NAMESPACE::V2f &pixelPosition)
const UT_String & getName() const
int getNumChannels() const
bool operator==(const BaseDimensions< T > &a, const BaseDimensions< Y > &b)
Definition: Dimensions.h:137
void setName(const UT_String &name)
CH_ChannelList & getModifyChannelList()
GLuint const GLchar * name
Definition: glcorearb.h:786
void removeChannel(int i)
fpreal64 fpreal
Definition: SYS_Types.h:277
#define CH_API
Definition: CH_API.h:10
LeafData & operator=(const LeafData &)=delete
const CH_ChannelList & getChannelList() const
bool isEmpty() 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)