cgma
CASourceFeature Class Reference

Attribute for managing RefEntity source feature types. More...

#include <CASourceFeature.hpp>

Inheritance diagram for CASourceFeature:
CubitAttrib

List of all members.

Public Member Functions

 CASourceFeature (RefEntity *, const CubitSimpleAttrib &)
 Constructor.
virtual ~CASourceFeature ()
 destructor
CubitStatus actuate ()
 Actuate.
CubitStatus update ()
 Update.
CubitStatus reset ()
 Reset function, cleans out name lists.
CubitSimpleAttrib cubit_simple_attrib ()
 Returns the simple cubit attribute for this attribute.
GeometryFeatureEngine::FeatureType string_to_feature_type (CubitString value_in)
 Given a cubit attribute string return the FeatureType.
CubitString feature_type_to_string (GeometryFeatureEngine::FeatureType type_in)
 Returning a cubit simple attribute string for the input feature type.
int int_attrib_type ()
 Return the #define attribute type.
void print ()
 Print this attribute to the output.

Private Attributes

GeometryFeatureEngine::FeatureType sourceFeature
 Temp source feature enum.

Detailed Description

Attribute for managing RefEntity source feature types.

Definition at line 13 of file CASourceFeature.hpp.


Constructor & Destructor Documentation

CASourceFeature::CASourceFeature ( RefEntity new_attrib_owner,
const CubitSimpleAttrib csa_ptr 
)

Constructor.

Definition at line 14 of file CASourceFeature.cpp.

                                 : CubitAttrib(new_attrib_owner)
{
    sourceFeature = GeometryFeatureEngine::FEATURE_UNDEFINED;

    if(!csa_ptr.isEmpty())
    {

      const std::vector<CubitString>& cs_list = csa_ptr.string_data_list();

      // step over the attribute type
      // now read name / option pairs
      if(cs_list.size()==2)
      {
        CubitString cs = cs_list[1];
          if (cs.length() == 0)
              PRINT_WARNING("Empty feature attribute for %s %d.\n",
              attribOwnerEntity->class_name(),
              attribOwnerEntity->id());
          else
              sourceFeature = string_to_feature_type(cs);
      }
      else
          deleteAttrib = CUBIT_TRUE;
    }
}

destructor

Definition at line 42 of file CASourceFeature.cpp.

{
}

Member Function Documentation

Actuate.

Implements CubitAttrib.

Definition at line 46 of file CASourceFeature.cpp.

{
    if (hasActuated == CUBIT_TRUE)
        return CUBIT_SUCCESS;

    // create a TDSourceFeature for the entity, if it doesn't already
    // exist
    TDSourceFeature *source_feature_data = 
        (TDSourceFeature *) attrib_owner()->get_TD(&TDSourceFeature::is_source_feature);

    if (!source_feature_data) 
    {
        // else make a new one
        TDSourceFeature* new_tool_data = new TDSourceFeature(sourceFeature);
        attrib_owner()->add_TD(new_tool_data);
    }

    delete_attrib(CUBIT_TRUE);
    hasActuated = CUBIT_TRUE;

    return CUBIT_SUCCESS;
}

Returns the simple cubit attribute for this attribute.

Implements CubitAttrib.

Definition at line 102 of file CASourceFeature.cpp.

{
    std::vector<CubitString> cs_list;

    // pack the string list:
    // character type of this CA
    cs_list.push_back(att_internal_name());

    // name, option pairs
    cs_list.push_back(feature_type_to_string(sourceFeature));

    return CubitSimpleAttrib(&cs_list, NULL, NULL);
}

Returning a cubit simple attribute string for the input feature type.

Definition at line 157 of file CASourceFeature.cpp.

{
    switch(type_in)
    {
    case GeometryFeatureEngine::FEATURE_IMPRINT:
        return "IMPRINT";
    case GeometryFeatureEngine::FEATURE_HOLE:
        return "HOLE";
    case GeometryFeatureEngine::FEATURE_ROUND:
        return "ROUND";
    case GeometryFeatureEngine::FEATURE_CHAMFER:
        return "CHAMFER";
    case GeometryFeatureEngine::FEATURE_SLOT:
        return "SLOT";
    case GeometryFeatureEngine::FEATURE_CUT:
        return "CUT";
    default:
        return "";
    }
}
int CASourceFeature::int_attrib_type ( ) [inline, virtual]

Return the #define attribute type.

Implements CubitAttrib.

Definition at line 47 of file CASourceFeature.hpp.

void CASourceFeature::print ( ) [virtual]

Print this attribute to the output.

Reimplemented from CubitAttrib.

Definition at line 117 of file CASourceFeature.cpp.

{
    // print info on this attribute
    PRINT_INFO("CASourceFeature: owner = %s %d; feature: ",
        attribOwnerEntity->class_name(), attribOwnerEntity->id());
    PRINT_INFO("%s ", feature_type_to_string(sourceFeature).c_str());

    PRINT_INFO("\n");
}

Reset function, cleans out name lists.

Implements CubitAttrib.

Definition at line 94 of file CASourceFeature.cpp.

Given a cubit attribute string return the FeatureType.

Definition at line 128 of file CASourceFeature.cpp.

{
    /*
    FEATURE_UNDEFINED,
    FEATURE_HOLE,       
    FEATURE_ROUND,      
    FEATURE_CHAMFER,    
    FEATURE_SLOT ,      
    FEATURE_CUT,
    FEATURE_IMPRINT
    */
    if(value_in == "IMPRINT")
        return GeometryFeatureEngine::FEATURE_IMPRINT;
    else if(value_in == "HOLE")
        return GeometryFeatureEngine::FEATURE_HOLE;
    else if(value_in == "ROUND")
        return GeometryFeatureEngine::FEATURE_ROUND;
    else if(value_in == "CHAMFER")
        return GeometryFeatureEngine::FEATURE_CHAMFER;
    else if(value_in == "SLOT")
        return GeometryFeatureEngine::FEATURE_SLOT;
    else if(value_in == "CUT")
        return GeometryFeatureEngine::FEATURE_CUT;
    else
        return GeometryFeatureEngine::FEATURE_UNDEFINED;
}

Update.

Implements CubitAttrib.

Definition at line 69 of file CASourceFeature.cpp.

{
    if(hasUpdated)
        return CUBIT_SUCCESS;

    // set the updated flag
    hasUpdated = CUBIT_TRUE;

    // if the owner has a unique id, save it, otherwise delete this one
    TDSourceFeature *source_feature_data = 
        (TDSourceFeature *) attrib_owner()->get_TD(&TDSourceFeature::is_source_feature);

    if (!source_feature_data)
        delete_attrib(CUBIT_TRUE);
    else
    {
        if (delete_attrib() == CUBIT_TRUE)
            delete_attrib(CUBIT_FALSE);

        sourceFeature = source_feature_data->source_feature();
    }

    return CUBIT_SUCCESS;
}

Member Data Documentation

Temp source feature enum.

Definition at line 17 of file CASourceFeature.hpp.


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