cgma
CGMApp Class Reference

#include <CGMApp.hpp>

List of all members.

Public Member Functions

 ~CGMApp ()
void startup (const std::vector< CubitString > &args)
void shutdown ()
CubitAttribManagerattrib_manager ()
void save_current_attribute_states ()
void restore_previous_attribute_states ()

Static Public Member Functions

static CGMAppinstance ()
static void delete_instance ()
static void initialize_settings ()

Private Member Functions

 CGMApp ()
void register_attributes ()

Private Attributes

CubitBoolean mAppStarted
CubitAttribManager mAttribManager
CubitBooleancaUpdateFlgs
CubitBooleancaActuateFlgs
CubitBooleancaWriteFlgs
CubitBooleancaReadFlgs

Static Private Attributes

static CGMAppinstance_ = NULL

Detailed Description

Definition at line 45 of file CGMApp.hpp.


Constructor & Destructor Documentation

Definition at line 81 of file CGMApp.cpp.

{
    instance_ = NULL;
}
CGMApp::CGMApp ( ) [private]

Definition at line 65 of file CGMApp.cpp.

{
    mAppStarted = CUBIT_FALSE;

      // CGMApp depends on there being an AppUtil
    AppUtil::instance();

      // initialize my settings
    initialize_settings();    
  
    caUpdateFlgs = NULL;
    caActuateFlgs = NULL;
    caWriteFlgs = NULL;
    caReadFlgs = NULL;
}

Member Function Documentation

Definition at line 241 of file CGMApp.cpp.

{
  return &mAttribManager;
}
static void CGMApp::delete_instance ( ) [inline, static]

Definition at line 51 of file CGMApp.hpp.

  {
    if (instance_)
      delete instance_;
    instance_ = NULL;
  };
CGMApp * CGMApp::instance ( ) [static]

Definition at line 51 of file CGMApp.cpp.

{
   if (instance_ == NULL)
   {
      instance_ = new CGMApp();
      if (!instance_ )
      {
         PRINT_ERROR(" *** Unable to initialize application ***\n");
         exit(1);
      }
   }
   return instance_;
}
void CGMApp::register_attributes ( ) [private]

Definition at line 128 of file CGMApp.cpp.

{
  CubitStatus result;
  result = mAttribManager.register_attrib_type(CA_MERGE_PARTNER, "merge", "MERGE_PARTNER", 
                                               CAMergePartner_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_FALSE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type merge.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_ENTITY_NAME, "name", "ENTITY_NAME", 
                                               CAEntityName_creator, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type name.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_GROUP, "group", "GROUP",
                                               CAGroup_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_FALSE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type group.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_ENTITY_ID, "id", "ENTITY_ID",
                                               CAEntityId_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type id.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_ENTITY_TOL, "tolerance", "ENTITY_TOL",
                                               CAEntityTol_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_FALSE, CUBIT_TRUE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type tolerance.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_UNIQUE_ID, "unique id", "UNIQUE_ID",
                                               CAUniqueId_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type unique id.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_DEFERRED_ATTRIB, "deferred attrib", "DEFERRED_ATTRIB",
                                               CADeferredAttrib_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_FALSE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type deferred attrib.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_ENTITY_COLOR, "color", "ENTITY_COLOR",
                                               CAEntityColor_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_FALSE, CUBIT_TRUE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type color.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_MERGE_STATUS, "merge status", "MERGE_STATUS",
                                               CAMergeStatus_creator, CUBIT_FALSE,
                                               CUBIT_FALSE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_FALSE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type merge status.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_SOURCE_FEATURE, "source feature", "SOURCE_FEATURE",
                                               CASourceFeature_creator, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type source feature.\n");
    return;
  }

  result = mAttribManager.register_attrib_type(CA_ENTITY_SENSE, "entity sense", "ENTITY_SENSE",
                                               CAEntitySense_creator, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_FALSE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type entity sense.\n");
    return;
  }

#ifdef CAT
  result = mAttribManager.register_attrib_type(CA_PRO_WELD, "pro weld", "PRO_WELD",
                                               CAProWeld_creator, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_TRUE, CUBIT_TRUE,
                                               CUBIT_TRUE, CUBIT_FALSE);
  if (CUBIT_SUCCESS != result) {
    PRINT_ERROR("Failed to register attribute type pro weld.\n");
  }
#endif
}

Definition at line 279 of file CGMApp.cpp.

{
  DLIList<int> attrib_types;
  mAttribManager.get_registered_types(attrib_types);

  int num_att = attrib_types.size();
  attrib_types.reset();
  int i;
  for( i=0; i<num_att; i++ )
  {
    int att_type = attrib_types.get();
    mAttribManager.set_auto_update_flag( att_type, caUpdateFlgs[i] );
    mAttribManager.set_auto_actuate_flag( att_type, caActuateFlgs[i] );
    mAttribManager.set_auto_write_flag( att_type, caWriteFlgs[i] );
    mAttribManager.set_auto_read_flag( att_type, caReadFlgs[i] );
    attrib_types.step();
  }
  
  delete [] caUpdateFlgs;
  delete [] caActuateFlgs;
  delete [] caWriteFlgs;
  delete [] caReadFlgs;

  caUpdateFlgs = NULL;
  caActuateFlgs = NULL;
  caWriteFlgs = NULL;
  caReadFlgs = NULL;
}

Definition at line 247 of file CGMApp.cpp.

{
  //all pointers must be NULL
  if( !!caUpdateFlgs && !!caActuateFlgs &&
      !!caWriteFlgs && !!caReadFlgs )
  {
    PRINT_ERROR("Problem setting attribute flags\n");
    return;
  }
    
  DLIList<int> attrib_types;
  mAttribManager.get_registered_types(attrib_types);

  caUpdateFlgs = new CubitBoolean[attrib_types.size()];
  caActuateFlgs = new CubitBoolean[attrib_types.size()];
  caWriteFlgs = new CubitBoolean[attrib_types.size()];
  caReadFlgs = new CubitBoolean[attrib_types.size()];

  int num_att = attrib_types.size();
  attrib_types.reset();
  int i;
  for( i=0; i<num_att; i++ )
  {
    int att_type = attrib_types.get();
    caUpdateFlgs[i] = mAttribManager.auto_update_flag( att_type );
    caActuateFlgs[i] = mAttribManager.auto_actuate_flag( att_type );
    caWriteFlgs[i] = mAttribManager.auto_write_flag( att_type );
    caReadFlgs[i] = mAttribManager.auto_read_flag( att_type );
    attrib_types.step();
  }
}
void CGMApp::startup ( const std::vector< CubitString > &  args)

Definition at line 86 of file CGMApp.cpp.

{
   if (mAppStarted)
       return;

    // make sure apputil has started
  AppUtil::instance()->startup();

     // register attributes
   register_attributes();

   mAppStarted = CUBIT_TRUE;
}

Member Data Documentation

Definition at line 84 of file CGMApp.hpp.

Definition at line 86 of file CGMApp.hpp.

Definition at line 83 of file CGMApp.hpp.

Definition at line 85 of file CGMApp.hpp.

CGMApp * CGMApp::instance_ = NULL [static, private]

Definition at line 75 of file CGMApp.hpp.

Definition at line 76 of file CGMApp.hpp.

Definition at line 77 of file CGMApp.hpp.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines