LCOV - code coverage report
Current view: top level - disks2/fathom/slaves/sigma2/cgm-occ-cov/build/itaps - CATag.hpp (source / functions) Hit Total Coverage
Test: coverage_sk.info Lines: 6 10 60.0 %
Date: 2020-06-30 00:58:45 Functions: 5 9 55.6 %
Branches: 4 8 50.0 %

           Branch data     Line data    Source code
       1                 :            : /**
       2                 :            :  * Copyright 2006 Sandia Corporation.  Under the terms of Contract
       3                 :            :  * DE-AC04-94AL85000 with Sandia Coroporation, the U.S. Government
       4                 :            :  * retains certain rights in this software.
       5                 :            :  * 
       6                 :            :  * This library is free software; you can redistribute it and/or
       7                 :            :  * modify it under the terms of the GNU Lesser General Public
       8                 :            :  * License as published by the Free Software Foundation; either
       9                 :            :  * version 2.1 of the License, or (at your option) any later version.
      10                 :            :  * 
      11                 :            :  */
      12                 :            :  
      13                 :            : /**\file CATag.hpp
      14                 :            :  *
      15                 :            :  *\author Tim Tautges
      16                 :            :  *\author Jason Kraftcheck
      17                 :            :  *
      18                 :            :  * Original file from SNL TSTT repository was named CATSTT.
      19                 :            :  *
      20                 :            :  * Renamed CATag and added to ANL ITAPS repository by J.Kraftcheck,
      21                 :            :  * 2007-6-15
      22                 :            :  */
      23                 :            : 
      24                 :            : #ifndef CA_TAG_HPP
      25                 :            : #define CA_TAG_HPP
      26                 :            : 
      27                 :            : #include <typeinfo>
      28                 :            : #if !defined(_WIN32)
      29                 :            : using std::type_info;
      30                 :            : #endif
      31                 :            : 
      32                 :            : #include "iGeom.h"
      33                 :            : #include "CubitAttrib.hpp"
      34                 :            : #include "DLIList.hpp"
      35                 :            : #include "CubitDefines.h"
      36                 :            : 
      37                 :            : #include <string>
      38                 :            : #include <map>
      39                 :            : #include <vector>
      40                 :            : 
      41                 :            : #ifdef ITAPS_SHIM
      42                 :            : typedef struct iGeom_Instance_Private *iGeom_Instance;
      43                 :            : # include "iGeom_binding.h"
      44                 :            : #endif
      45                 :            : 
      46                 :            : #define ARRAY_IN_DECL(a, b) \
      47                 :            :   a const* b, const int b ## _size  
      48                 :            : 
      49                 :            : #define ARRAY_INOUT_DECL(a, b) \
      50                 :            :   a **b, int *b ## _allocated, int *b ## _size  
      51                 :            : 
      52                 :            : class RefEntity;
      53                 :            : class RefGroup;
      54                 :            : class CATag;
      55                 :            : 
      56                 :            : class CGMTagManager 
      57                 :            : {
      58                 :            : public:
      59                 :            : #ifdef ITAPS_SHIM
      60                 :            :   iGeom_vtable *vtable;
      61                 :            : #endif
      62                 :            : 
      63                 :            :   friend class CATag;
      64                 :            :   
      65                 :            :   ~CGMTagManager();
      66                 :            :   
      67                 :        112 :   struct TagInfo
      68                 :            :   {
      69                 :            :     int tagLength;
      70                 :            :     std::string tagName;
      71                 :            :     int tagType;
      72                 :            :     char *defaultValue;
      73                 :            :     bool isActive;
      74                 :            :   };
      75                 :            :   
      76                 :            :   static CubitAttrib* CATag_creator(RefEntity* entity, const CubitSimpleAttrib &p_csa);
      77                 :            : 
      78                 :            :   iBase_ErrorType createTag (/*in*/ const char *tag_name,
      79                 :            :                              /*in*/ const int tag_size,
      80                 :            :                              /*in*/ const int tag_type,
      81                 :            :                              /*in*/ char* default_value,
      82                 :            :                              /*out*/ long *tag_handle);
      83                 :            : 
      84                 :            :   iBase_ErrorType destroyTag (/*in*/ const long tag_handle,
      85                 :            :                               /*in*/ const bool forced);
      86                 :            : 
      87                 :            :   const char *getTagName (/*in*/ const long tag_handle);
      88                 :            : 
      89                 :            :   int getTagSize (/*in*/ const long tag_handle);
      90                 :            : 
      91                 :            :   long getTagHandle (/*in*/ const char *tag_name);
      92                 :            : 
      93                 :            :   int getTagType (/*in*/ const long tag_handle);
      94                 :            : 
      95                 :            :   iBase_ErrorType getArrData ( ARRAY_IN_DECL(RefEntity*, entity_handles),
      96                 :            :                               /*in*/ const long tag_handle,
      97                 :            :                               /*inout*/ ARRAY_INOUT_DECL(char, tag_value));
      98                 :            : 
      99                 :            :   iBase_ErrorType setArrData (/*in*/ ARRAY_IN_DECL(RefEntity*, entity_handles),
     100                 :            :                               /*in*/ const long tag_handle,
     101                 :            :                               /*in*/ const char *tag_values,
     102                 :            :                               const int tag_values_size);
     103                 :            : 
     104                 :            :   iBase_ErrorType rmvArrTag (/*in*/ ARRAY_IN_DECL(RefEntity*, entity_handles),
     105                 :            :                              /*in*/ const long tag_handle);
     106                 :            : 
     107                 :            :   iBase_ErrorType getAllTags (/*in*/ const RefEntity* entity_handle,
     108                 :            :                               /*inout*/ ARRAY_INOUT_DECL(long, tag_handles));
     109                 :            : 
     110                 :            :   std::vector<RefGroup*> *pc_list(RefEntity *gentity, int list_no, 
     111                 :            :                                   const bool create_if_missing);
     112                 :            : 
     113                 :            :   void pc_list(RefEntity *gentity, std::vector<RefGroup*> *&parents,
     114                 :            :                std::vector<RefGroup*> *&children,
     115                 :            :                const bool create_if_missing);
     116                 :            : 
     117                 :            :   void get_pc_groups(RefGroup *this_grp, const int p_or_c, const int num_hops,
     118                 :            :                      std::vector<RefGroup *> &group_ptrs);
     119                 :            : 
     120                 :            :   iBase_ErrorType create_csa_tag(const char *tag_name, long *tag_handle);
     121                 :            :   
     122                 :            :   iBase_ErrorType set_csa_tag(RefEntity *this_ent,
     123                 :            :                               long tag_handle,
     124                 :            :                               CubitSimpleAttrib *csa_ptr);
     125                 :            :   
     126                 :        692 :   static inline CGMTagManager& instance()
     127                 :            :   {
     128 [ +  + ][ +  - ]:        692 :     static CGMTagManager static_instance;
         [ +  - ][ #  # ]
     129                 :        692 :     return static_instance;
     130                 :            :   }
     131                 :            : 
     132                 :            : private:
     133                 :            :   CGMTagManager();
     134                 :            : 
     135                 :            :   int CATag_att_type;
     136                 :            :   long pcTag;
     137                 :            :   std::vector<TagInfo> tagInfo;
     138                 :            :   static TagInfo* const presetTagInfo;
     139                 :            :   static const int numPresetTag;
     140                 :            :   std::map<std::string, long> tagNameMap;
     141                 :            :   static const char *CATag_NAME;
     142                 :            :   static const char *CATag_NAME_INTERNAL;
     143                 :            :   RefGroup *interfaceGroup;
     144                 :            : 
     145                 :            :   bool getPresetTagData(const RefEntity *entity, const long tag_num, 
     146                 :            :                         char *tag_value, int &tag_size);
     147                 :            : 
     148                 :            :   iBase_ErrorType setPresetTagData(RefEntity *entity, const long tag_num, 
     149                 :            :                                    const char *tag_value, const int tag_size);
     150                 :            :   
     151                 :            :   CATag *get_catag(RefEntity *ent, 
     152                 :            :                    const bool create_if_missing = false);
     153                 :            : 
     154                 :            :   long pc_tag(const bool create_if_missing = false);
     155                 :            :   
     156                 :            :   RefGroup *interface_group(const bool create_if_missing = true);
     157                 :            :   
     158                 :            :   CubitSimpleAttrib* get_simple_attrib( RefEntity* entity, const char* name );  
     159                 :            : };
     160                 :            : 
     161                 :            : class CATag: public CubitAttrib
     162                 :            : {
     163                 :            : private:
     164                 :            :   friend class CGMTagManager;
     165                 :            :  
     166                 :            :   std::map<int, void*> tagData;
     167                 :            : 
     168                 :            :   CGMTagManager *myManager;
     169                 :            : 
     170                 :            :   CATag(CGMTagManager *manager, RefEntity *owner);
     171                 :            : 
     172                 :            :   CATag(CGMTagManager *manager, RefEntity *owner, CubitSimpleAttrib *csa_ptr);
     173                 :            :     //- create a CATag from a simple attribute
     174                 :            : 
     175                 :            : public:
     176                 :            : 
     177                 :            :   virtual ~CATag();
     178                 :            : 
     179                 :            :     //HEADER- RTTI and safe casting functions.
     180                 :          0 :   virtual const type_info& entity_type_info() const
     181                 :          0 :     { return typeid(CATag);}
     182                 :            :     //R- The geometric modeler type
     183                 :            :     //- This function returns the type of the geometric modeler.
     184                 :            : 
     185                 :          8 :   CubitStatus actuate() {return CUBIT_SUCCESS;}
     186                 :            : 
     187                 :            :   CubitStatus update();
     188                 :            : 
     189                 :            :   CubitStatus reset();
     190                 :            : 
     191                 :          0 :   CubitSimpleAttrib split_owner() { CubitSimpleAttrib sa; return sa; }
     192                 :            : 
     193                 :          0 :   void merge_owner(CubitAttrib *deletable_attrib) {}
     194                 :            : 
     195                 :            :   CubitSimpleAttrib cubit_simple_attrib();
     196                 :            : 
     197                 :       1516 :   int int_attrib_type() {return myManager->CATag_att_type;}
     198                 :            : 
     199                 :            :   void add_csa_data(CubitSimpleAttrib *csa_ptr);
     200                 :            : 
     201                 :            :   void print();
     202                 :            : 
     203                 :            :   iBase_ErrorType get_tag_data(long tag_num, void *tag_data);
     204                 :            :   
     205                 :            :   iBase_ErrorType set_tag_data(long tag_num, const void *tag_data,
     206                 :            :                                const bool can_shallow_copy = false);
     207                 :            : 
     208                 :            :   void remove_tag(long tag_num);
     209                 :            : };
     210                 :            : 
     211                 :            : #endif
     212                 :            : 

Generated by: LCOV version 1.11