root/cgm/cgm_apps/TSTT/CATSTT.hpp @ 1040

Revision 1040, 4.5 KB (checked in by tautges, 2 years ago)

Version 10.2 of cgm.

Line 
1//- Class:          CATSTT
2//- Owner:          Greg Nielson
3//- Description:    Cubit attribute for entity names.
4//- Checked by:
5//- Version:
6
7#ifndef CA_TSTT_HPP
8#define CA_TSTT_HPP
9
10#include "sidlArray.h"
11#include "TSTTG.hh"
12#include "CubitAttrib.hpp"
13#include "DLIList.hpp"
14#include "CubitDefines.h"
15
16#include <string>
17#include <map>
18#include <vector>
19
20#define ARRAY_IN_DECL(a, b) \
21  a *b, const int b ## _size 
22
23#define ARRAY_INOUT_DECL(a, b) \
24  a **b, int *b ## _allocated, int *b ## _size 
25
26class RefEntity;
27class RefGroup;
28
29class CGMTagManager 
30{
31public:
32
33  friend class CATSTT;
34 
35  CGMTagManager();
36  ~CGMTagManager();
37 
38  struct TagInfo
39  {
40    int tagLength;
41    std::string tagName;
42    int tagType;
43    char *defaultValue;
44    bool isActive;
45  };
46 
47  static CubitAttrib* CATSTT_creator(RefEntity* entity, CubitSimpleAttrib *p_csa);
48
49  CubitStatus createTag (/*in*/ const char *tag_name,
50                         /*in*/ const int tag_size,
51                         /*in*/ const int tag_type,
52                         /*in*/ char* default_value,
53                         /*out*/ int *tag_handle);
54
55  CubitStatus destroyTag (/*in*/ const int tag_handle,
56                          /*in*/ const bool forced);
57
58  const char *getTagName (/*in*/ const int tag_handle);
59
60  int getTagSize (/*in*/ const int tag_handle);
61
62  int getTagHandle (/*in*/ const char *tag_name);
63
64  int getTagType (/*in*/ const int tag_handle);
65
66  CubitStatus getArrData (const RefEntity**entity_handles, 
67                          const int entity_handles_size,
68                          /*in*/ const int tag_handle,
69                          /*inout*/ ARRAY_INOUT_DECL(char, tag_value));
70
71  CubitStatus setArrData (/*in*/ ARRAY_IN_DECL(RefEntity*, entity_handles),
72                          /*in*/ const int tag_handle,
73                          /*in*/ const char *tag_values,
74                          const int tag_values_size);
75
76  CubitStatus rmvArrTag (/*in*/ ARRAY_IN_DECL(RefEntity*, entity_handles),
77                         /*in*/ const int tag_handle);
78
79  CubitStatus getAllTags (/*in*/ const RefEntity* entity_handle,
80                          /*inout*/ ARRAY_INOUT_DECL(int, tag_handles));
81
82  std::vector<RefGroup*> *pc_list(RefEntity *gentity, int list_no, 
83                                  const bool create_if_missing);
84
85  void pc_list(RefEntity *gentity, std::vector<RefGroup*> *&parents,
86               std::vector<RefGroup*> *&children,
87               const bool create_if_missing);
88
89  void get_pc_groups(RefGroup *this_grp, const int p_or_c, const int num_hops,
90                     std::vector<RefGroup *> &group_ptrs);
91
92private:
93  int CATSTT_att_type;
94  int pcTag;
95  std::vector<TagInfo> tagInfo;
96  std::vector<TagInfo> presetTagInfo;
97  std::map<std::string, int> tagNameMap;
98  static const char *CATSTT_NAME;
99  static const char *CATSTT_NAME_INTERNAL;
100  RefGroup *interfaceGroup;
101  static CGMTagManager *staticCGMTagManager;
102
103  bool getPresetTagData(const RefEntity *entity, const int tag_num, 
104                        char *tag_value, int &tag_size);
105
106  void setPresetTagData(RefEntity *entity, const int tag_num, 
107                        const char *tag_value, const int tag_size);
108 
109  CATSTT *get_catstt(RefEntity *ent, 
110                     const bool create_if_missing = false);
111
112  int pc_tag(const bool create_if_missing = false);
113 
114  RefGroup *interface_group(const bool create_if_missing = true);
115 
116};
117
118class CATSTT: public CubitAttrib
119{
120private:
121  friend class CGMTagManager;
122 
123  std::map<int, void*> tagData;
124
125  CGMTagManager *myManager;
126
127  CATSTT(CGMTagManager *manager, RefEntity *owner);
128
129  CATSTT(CGMTagManager *manager, RefEntity *owner, CubitSimpleAttrib *csa_ptr);
130    //- create a CATSTT from a simple attribute
131
132public:
133
134  virtual ~CATSTT();
135
136  //HEADER- RTTI and safe casting functions.
137  virtual const type_info& entity_type_info() const
138     { return typeid(CATSTT);}
139  //R- The geometric modeler type
140  //- This function returns the type of the geometric modeler.
141
142  CubitStatus actuate() {return CUBIT_SUCCESS;}
143
144  CubitStatus update();
145
146  CubitStatus reset();
147
148  CubitSimpleAttrib *split_owner() {return NULL;}
149
150  void merge_owner(CubitAttrib *deletable_attrib) {}
151
152  CubitSimpleAttrib* cubit_simple_attrib();
153
154  int int_attrib_type() {return myManager->CATSTT_att_type;}
155
156  void add_csa_data(CubitSimpleAttrib *csa_ptr);
157
158  void print();
159
160  CubitStatus get_tag_data(int tag_num, void *tag_data);
161 
162  CubitStatus set_tag_data(int tag_num, const void *tag_data,
163       const bool can_shallow_copy = false);
164
165  void remove_tag(int tag_num);
166};
167
168#endif
Note: See TracBrowser for help on using the browser.