HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GDT_ParmDataItem.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: GDT_ParmDataItem.h ( GU Library, C++)
7  *
8  * COMMENTS: Represents geometry delta in parameter.
9  */
10 
11 #ifndef __GDT_ParmDataItem__
12 #define __GDT_ParmDataItem__
13 
14 #include "GDT_API.h"
15 #include "GDT_Detail.h"
16 #include <PRM/PRM_Parm.h>
17 #include <PRM/PRM_Type.h>
18 
20 {
21 public:
23  : myDelta(0)
24  {}
25 
26  // We gain ownership of this delta, and will free it on completion.
28  : myDelta(delta)
29  {}
30 
31  ~GDT_ParmDataItem() override
32  {
33  delete myDelta;
34  }
35 
37  { return PRM_Type::PRM_DATA_GEODELTA; }
38  const char *getDataTypeToken() const override { return "geodelta"; }
39 
40  bool saveAscii(std::ostream &os) const override;
41  bool saveBinary(std::ostream &os) const override;
42 
43  int64 getMemoryUsage() const override
44  {
45  return sizeof(*this)
46  // TODO: Memory usage of GDT_Detail
47  // + (myDelta ? myDelta->getMemoryUsage() : 0)
48  ;
49  }
50 
51  // Override as getDataTypeToken() and saveAscii() are known to be "safe".
52  bool canSaveAsUnprotectedString() const override { return true; }
53 
54  /// The parameters delta, can be null.
55  const GDT_Detail *delta() const { return myDelta; }
56 
57  /// Steals the delta & resets this to null. Care must be taken
58  /// that the parent handle is unique or you may destroy deltas
59  /// held by other parametrs.
60  GDT_Detail *steal() { GDT_Detail *result = myDelta; myDelta = 0; return result; }
61 
62 private:
63  GDT_Detail *myDelta;
64 };
65 
66 #endif
virtual bool saveBinary(std::ostream &os) const =0
#define GDT_API
Definition: GDT_API.h:10
**But if you need a result
Definition: thread.h:613
~GDT_ParmDataItem() override
int64 getMemoryUsage() const override
bool canSaveAsUnprotectedString() const override
virtual bool saveAscii(std::ostream &os) const =0
GDT_ParmDataItem(GDT_Detail *delta)
GDT_Detail * steal()
long long int64
Definition: SYS_Types.h:116
PRM_Type::PRM_DataType getDataType() const override
const char * getDataTypeToken() const override
PRM_DataType
Definition: PRM_Type.h:112
const GDT_Detail * delta() const
The parameters delta, can be null.