cgma
|
#include <FacetAttribSet.hpp>
Public Member Functions | |
FacetAttribSet () | |
~FacetAttribSet () | |
void | append_attribute (const CubitSimpleAttrib &) |
void | remove_attribute (const CubitSimpleAttrib &) |
void | remove_all_attributes () |
CubitStatus | get_attributes (DLIList< CubitSimpleAttrib > &) const |
CubitStatus | get_attributes (const CubitString &name, DLIList< CubitSimpleAttrib > &) const |
CubitStatus | save_attributes (FILE *file) const |
CubitStatus | restore_attributes (FILE *file, unsigned int endian) |
int | attribute_count () const |
Private Attributes | |
FacetAttrib * | listHead |
Definition at line 22 of file FacetAttribSet.hpp.
FacetAttribSet::FacetAttribSet | ( | ) | [inline] |
Definition at line 27 of file FacetAttribSet.hpp.
: listHead(0) {}
FacetAttribSet::~FacetAttribSet | ( | ) | [inline] |
Definition at line 29 of file FacetAttribSet.hpp.
{ remove_all_attributes(); }
void FacetAttribSet::append_attribute | ( | const CubitSimpleAttrib & | csa | ) |
Definition at line 18 of file FacetAttribSet.cpp.
{ FacetAttrib* new_attrib = new FacetAttrib(csa); new_attrib->listNext = listHead; listHead = new_attrib; }
int FacetAttribSet::attribute_count | ( | ) | const |
Definition at line 121 of file FacetAttribSet.cpp.
{ int count = 0; for( FacetAttrib* attrib = listHead; attrib; attrib = attrib->listNext ) count++; return count; }
CubitStatus FacetAttribSet::get_attributes | ( | DLIList< CubitSimpleAttrib > & | list | ) | const |
Definition at line 61 of file FacetAttribSet.cpp.
{ for( FacetAttrib* attrib = listHead; attrib; attrib = attrib->listNext ) list.append( attrib->get_CSA() ); return CUBIT_SUCCESS; }
CubitStatus FacetAttribSet::get_attributes | ( | const CubitString & | name, |
DLIList< CubitSimpleAttrib > & | list | ||
) | const |
Definition at line 68 of file FacetAttribSet.cpp.
{ for( FacetAttrib* attrib = listHead; attrib; attrib = attrib->listNext ) if( attrib->name() == name ) list.append( attrib->get_CSA() ); return CUBIT_SUCCESS; }
Definition at line 51 of file FacetAttribSet.cpp.
{ while( listHead ) { FacetAttrib* dead = listHead; listHead = dead->listNext; delete dead; } }
void FacetAttribSet::remove_attribute | ( | const CubitSimpleAttrib & | csa | ) |
Definition at line 25 of file FacetAttribSet.cpp.
{ if( !listHead ) return; FacetAttrib* attrib = 0; if ( listHead->equals(csa) ) { attrib = listHead; listHead = listHead->listNext; delete attrib; return; } for ( FacetAttrib* prev = listHead; prev->listNext; prev = prev->listNext ) { if( prev->listNext->equals(csa) ) { attrib = prev->listNext; prev->listNext = attrib->listNext; delete attrib; return; } } }
CubitStatus FacetAttribSet::restore_attributes | ( | FILE * | file, |
unsigned int | endian | ||
) |
Definition at line 95 of file FacetAttribSet.cpp.
{ FacetAttrib *curr_attrib; //Read # attribs unsigned int size; NCubitFile::CIOWrapper wrapper( endian, file_ptr ); wrapper.Read( &size, 1 ); for (unsigned i = 0; i < size; i++) { curr_attrib = FacetAttrib::restore( file_ptr, endian); if (!curr_attrib) { // file corrupt? don't try to read any more return CUBIT_FAILURE; } curr_attrib->listNext = listHead; listHead = curr_attrib; } return CUBIT_SUCCESS; }
CubitStatus FacetAttribSet::save_attributes | ( | FILE * | file | ) | const |
Definition at line 77 of file FacetAttribSet.cpp.
{ FacetAttrib *curr_attrib; CubitStatus status = CUBIT_SUCCESS; //save # attribs unsigned int size = attribute_count(); NCubitFile::CIOWrapper wrapper( file_ptr ); wrapper.Write( &size, 1 ); //save each attrib for( curr_attrib = listHead; curr_attrib; curr_attrib = curr_attrib->listNext ) if( !curr_attrib->save(file_ptr) ) status = CUBIT_FAILURE; return status; }
FacetAttrib* FacetAttribSet::listHead [private] |
Definition at line 50 of file FacetAttribSet.hpp.