HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_GroupList.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: OP library (C++)
7  *
8  * COMMENTS:
9  *
10  * BUGS:
11  *
12  */
13 
14 #ifndef __OP_GroupList_h__
15 #define __OP_GroupList_h__
16 
17 #include "OP_API.h"
18 #include "OP_Error.h"
19 #include <UT/UT_ValArray.h>
20 #include <SYS/SYS_Types.h>
21 #include <iosfwd>
22 
23 class OP_Node;
24 class OP_Network;
25 class OP_Group;
26 
28 {
29 public:
30  OP_GroupList(OP_Network *owner);
31  // NOTE: We don't need a virtual destructor, because our superclass
32  // has a non-virtual destructor, and this is only destructed
33  // as type OP_GroupList.
34  ~OP_GroupList();
35 
36  void clearAndDestroy(); // Destroy all groups
37 
38  OP_Group *createGroup(const char *name, fpreal x = .0F, fpreal y = .0F);
39  OP_Group *findGroup(const char *name) const;
40  int deleteGroup(const char *name);
41  int deleteGroup(OP_Group *group);
42 //
43 // getMembers will provide an array of pointers to all groups in the list.
44 // If the internal flag is zero this will not include internal groups.
45 //
46  int getMembers(UT_ValArray<OP_Group *> &list, int internal=0) const;
47 //
48 // getMemberships will provide an array of pointers to the groups that
49 // the specified node is a member of. The return value is the number of
50 // groups returned. If the internal flag is set the list will include
51 // internal groups.
52 //
53  int getMemberships(const OP_Node *node,
55  int internal=0) const;
56 
57 //
58 // saveCount returns the number of groups that would be saved if you
59 // performed a save operation. This does not count internal groups.
60 //
61  int saveCount() const;
62  void saveToClipboard(std::ostream &os, int all=0, int list=0) const;
63  bool loadFromClipboard(UT_IStream &is, const char *path) const;
64  OP_ERROR save(std::ostream &os, int binary = 0);
65  bool load(UT_IStream &is, int merge = 0);
66 
67  void clearUndoFlags();
68 
69  /// Return the amount of memory owned by this OP_GroupList
70  int64 getMemoryUsage(bool inclusive) const;
71 
72  /// Array-like methods
73  /// @{
74  using GroupPtr = OP_Group*;
75  void entries(exint n) { myGroups.entries(n); }
76  exint entries() const { return myGroups.entries(); }
77  void setSize(exint n) { myGroups.setSize(n); }
78  exint size() const { return myGroups.size(); }
79  void setCapacity(exint n) { myGroups.setCapacity(n); }
80  exint capacity(exint n) { return myGroups.capacity(); }
81  GroupPtr &operator()(exint i) { return myGroups(i); }
82  GroupPtr const &operator()(exint i) const { return myGroups(i); }
83  exint append() { return myGroups.append(); }
84  exint append(const GroupPtr &t) { return myGroups.append(t); }
85  exint append(GroupPtr &&t) { return myGroups.append(t); }
86  /// @}
87 
88 private:
89  OP_Network *myNetwork;
90  UT_ValArray<OP_Group *> myGroups;
91 };
92 
93 #endif
void setSize(exint n)
Definition: OP_GroupList.h:77
exint append()
Definition: OP_GroupList.h:83
exint append(const GroupPtr &t)
Definition: OP_GroupList.h:84
const GLuint GLenum const void * binary
Definition: glcorearb.h:1924
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
int64 exint
Definition: SYS_Types.h:125
UT_ErrorSeverity
Definition: UT_Error.h:25
GLuint const GLchar * name
Definition: glcorearb.h:786
GLdouble GLdouble t
Definition: glew.h:1403
GLint GLenum GLint x
Definition: glcorearb.h:409
GroupPtr const & operator()(exint i) const
Definition: OP_GroupList.h:82
void setCapacity(exint n)
Definition: OP_GroupList.h:79
long long int64
Definition: SYS_Types.h:116
exint capacity(exint n)
Definition: OP_GroupList.h:80
GLdouble n
Definition: glcorearb.h:2008
exint entries() const
Definition: OP_GroupList.h:76
fpreal64 fpreal
Definition: SYS_Types.h:277
GroupPtr & operator()(exint i)
Definition: OP_GroupList.h:81
#define OP_API
Definition: OP_API.h:10
GLboolean GLuint group
Definition: glew.h:2750
bool all(const vbool4 &v)
Definition: simd.h:3467
void entries(exint n)
Definition: OP_GroupList.h:75
GLint y
Definition: glcorearb.h:103
exint append(GroupPtr &&t)
Definition: OP_GroupList.h:85
exint size() const
Definition: OP_GroupList.h:78