HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OP_DotList.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_DotList.h (OP Library, C++)
7  *
8  * COMMENTS:
9  */
10 
11 #ifndef __OP_DotList__
12 #define __OP_DotList__
13 
14 #include "OP_API.h"
15 #include "OP_DataTypes.h"
16 #include "OP_Error.h"
17 #include "OP_SaveFlags.h"
18 #include <UT/UT_Array.h>
19 #include <iosfwd>
20 
21 class UT_IStream;
22 class OP_Network;
23 class OP_Input;
24 class OP_Dot;
25 
27 {
29 
30 public:
31  OP_DotList(OP_Network &net);
32  ~OP_DotList();
33 
34  exint entries() const
35  { return myDots.entries(); }
36  OP_Dot *operator()(exint idx) const
37  { return (idx >= 0 && idx < entries())
38  ? myDots(idx)
39  : nullptr; }
40  exint find(OP_Dot *dot) const
41  { return myDots.find(dot); }
42 
45 
46  iterator begin() { return myDots.begin(); }
47  iterator end() { return myDots.end(); }
48  const_iterator begin() const { return myDots.begin(); }
49  const_iterator end() const { return myDots.end(); }
50 
51  OP_Dot *findDot(const char *name) const;
52  OP_Dot *createDot(bool save_undo = true);
53  bool deleteDot(OP_Dot &dot_to_delete,
54  bool save_undo = true);
55  void clearAndDestroy();
56 
57  /// Save a single dot into a CPIO packet.
58  OP_ERROR save(std::ostream &os,
59  OP_Dot &dot,
60  const OP_SaveFlags &flags,
61  const char *path_prefix) const;
62 
63  /// Load a network box from 'is'. Can load from both .hip files and the
64  /// clipboard. 'path' is used as the new netbox's name (only the portion of
65  /// path after the last slash). If 'overwrite' is specified, the new netbox
66  /// will overwrite any other netboxes in this network with the same name,
67  /// rather than modify its name to be unique. 'created' is used to return a
68  /// ptr to the new network box.
69  bool load(UT_IStream &is, const char *path,
70  bool path_contains_network,
71  bool path_contains_packet_ext,
73  OP_Dot **created = NULL);
74 
75  /// Return the amount of memory owned by this OP_DotList
76  int64 getMemoryUsage(bool inclusive) const;
77 
78 private:
79  bool deleteDot(int idx, bool save_undo = true);
80 
81  DotArray myDots;
82  OP_Network &myNetwork;
83 };
84 
85 #endif
GLbitfield flags
Definition: glcorearb.h:1596
GLsizei const GLchar *const * path
Definition: glcorearb.h:3341
int64 exint
Definition: SYS_Types.h:125
exint find(OP_Dot *dot) const
Definition: OP_DotList.h:40
UT_ErrorSeverity
Definition: UT_Error.h:25
DotArray::const_iterator const_iterator
Definition: OP_DotList.h:44
DotArray::iterator iterator
Definition: OP_DotList.h:43
fpreal64 dot(const CE_VectorT< T > &a, const CE_VectorT< T > &b)
Definition: CE_Vector.h:130
const_iterator begin() const
Definition: OP_DotList.h:48
base_iterator< OP_Dot *, true > iterator
Definition: UT_Array.h:978
long long int64
Definition: SYS_Types.h:116
GLuint const GLchar * name
Definition: glcorearb.h:786
Definition: OP_Dot.h:24
const_iterator end() const
Definition: OP_DotList.h:49
OP_OverwriteAction
Definition: OP_DataTypes.h:121
OP_Dot * operator()(exint idx) const
Definition: OP_DotList.h:36
#define OP_API
Definition: OP_API.h:10
base_iterator< const OP_Dot *, true > const_iterator
Definition: UT_Array.h:979
exint entries() const
Definition: OP_DotList.h:34
iterator end()
Definition: OP_DotList.h:47
iterator begin()
Definition: OP_DotList.h:46