Back to index

salome-gui  6.5.0
Public Member Functions | Private Types | Private Member Functions | Private Attributes | Friends
DDS_DicGroup Class Reference

This class provides a set of DDS_DicItem objects from one component. More...

#include <DDS_DicGroup.h>

List of all members.

Public Member Functions

 DDS_DicGroup (const TCollection_AsciiString &)
 Constructor.
TCollection_AsciiString GetName () const
 Get the name of group (component).
Standard_EXPORT void GetKeys (TColStd_SequenceOfAsciiString &) const
 Return all keys of the group.
Standard_EXPORT Handle (DDS_DicItem) GetDicItem(const TCollection_AsciiString &) const
Standard_EXPORT void GetUnitSystems (TColStd_SequenceOfAsciiString &) const
 Get the names of all defined units systems.
Standard_EXPORT
TCollection_ExtendedString 
GetUnitSystemLabel (const TCollection_AsciiString &) const
 Get the label of units system name.
Standard_EXPORT
TCollection_AsciiString 
GetActiveUnitSystem () const
 Get the name of active units system.
Standard_EXPORT void SetActiveUnitSystem (const TCollection_AsciiString &)
 Set the active unit system.

Private Types

typedef NCollection_DataMap
< TCollection_AsciiString,
TCollection_ExtendedString > 
UnitSystemMap

Private Member Functions

 DDS_DicGroup (const DDS_DicGroup &)
 Copy constructor (put in private section to prevent object copying).
void operator= (const DDS_DicGroup &)
 Assignment operator (put in private section to prevent object copying).
void FillDataMap (const LDOM_Element &, const LDOM_Element &)
 Fill the internal data structures from XML parsed structures.

Private Attributes

TCollection_AsciiString myName
DDS_IndexedDataMapOfDicItems myDataMap
UnitSystemMap myUnitSystem
TCollection_AsciiString myActiveSystem
TColStd_SequenceOfAsciiString myKeys

Friends

class DDS_Dictionary

Detailed Description

This class provides a set of DDS_DicItem objects from one component.

Definition at line 38 of file DDS_DicGroup.h.


Member Typedef Documentation

typedef NCollection_DataMap<TCollection_AsciiString, TCollection_ExtendedString> DDS_DicGroup::UnitSystemMap [private]

Definition at line 63 of file DDS_DicGroup.h.


Constructor & Destructor Documentation

DDS_DicGroup::DDS_DicGroup ( const TCollection_AsciiString &  name)

Constructor.

Create the group with name name.

Parameters:
namegroup name

Definition at line 50 of file DDS_DicGroup.cxx.

: MMgt_TShared(),
  myName( name ),
  myActiveSystem( UNIT_SYSTEM_SI )
{
}
DDS_DicGroup::DDS_DicGroup ( const DDS_DicGroup ) [private]

Copy constructor (put in private section to prevent object copying).

Definition at line 60 of file DDS_DicGroup.cxx.

{
}

Member Function Documentation

void DDS_DicGroup::FillDataMap ( const LDOM_Element &  theComponentData,
const LDOM_Element &  theDocElement 
) [private]

Fill the internal data structures from XML parsed structures.

Parameters:
theComponentDatacomponent data DOM node
theDocElementdocument element DOM node

Definition at line 136 of file DDS_DicGroup.cxx.

{
  TCollection_AsciiString aCompName = theComponentData.getAttribute( DDS_Dictionary::KeyWord( "COMPONENT_NAME" ) );

  LDOM_Element systems = theComponentData.GetChildByTagName( DDS_Dictionary::KeyWord( "UNIT_SYSTEMS" ) );
  if ( !systems.isNull() )
  {
    LDOM_NodeList systemList = systems.getElementsByTagName( DDS_Dictionary::KeyWord( "UNIT_SYSTEM" ) );
    for ( Standard_Integer i = 0; i < systemList.getLength(); i++ )
    {
      //const LDOM_Element& aSystem = (const LDOM_Element &)systemList.item( i );
      LDOM_Node aNode = systemList.item( i );
      const LDOM_Element& anElem = (const LDOM_Element&) aNode;
      LDOM_Element aSystem(anElem);
      TCollection_AsciiString aName = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_NAME" ) );
      TCollection_ExtendedString aLabel = aSystem.getAttribute( DDS_Dictionary::KeyWord( "UNIT_SYSTEM_LABEL" ) );

      if ( aName.IsEmpty() )
        continue;

      if ( !myUnitSystem.IsBound( aName ) )
        myUnitSystem.Bind( aName, aLabel );


    }
  }

  if ( !myUnitSystem.IsBound( UNIT_SYSTEM_SI ) )
  {
    printf( "Warning: Mandatory unit system SI not defined in component: \"%s\". Added automaticaly", aCompName.ToCString() );
    myUnitSystem.Bind( UNIT_SYSTEM_SI, TCollection_ExtendedString( "System international" ) );
  }

  TColStd_SequenceOfAsciiString unitSystems;
  GetUnitSystems( unitSystems );

  LDOM_NodeList aData = theComponentData.getElementsByTagName( DDS_Dictionary::KeyWord( "DATUM" ) );
  if ( !aData.getLength() )
    return;

  for ( Standard_Integer i = 0; i < aData.getLength(); i++ )
  {
    //LDOM_Element aQuantity = (const LDOM_Element&)aData.item( i );
    LDOM_Node aNode = aData.item( i );
    const LDOM_Element& anElem = (const LDOM_Element&) aNode;
    LDOM_Element aQuantity(anElem);

    // 1. Attributes (id,label,units?,format?,required?)
    TCollection_AsciiString anID = aQuantity.getAttribute( DDS_Dictionary::KeyWord( "DATUM_ID" ) );
    Handle(DDS_DicItem) aDicItem = new DDS_DicItem();

    aDicItem->myComponent = this;
    aDicItem->FillDataMap( anID, aQuantity, theComponentData, theDocElement, unitSystems );
    myDataMap.Add( anID, aDicItem );

    bool exist = false;
    for( int i=1, n=myKeys.Length(); i<=n && !exist; i++ )
      if( myKeys.Value( i )==anID )
      {
        cout << "Doubled key:" << anID << endl;
        exist = true;
      }
    if( !exist )
      myKeys.Append( anID );
  }
}

Here is the call graph for this function:

TCollection_AsciiString DDS_DicGroup::GetActiveUnitSystem ( ) const

Get the name of active units system.

Returns:
active units system name

Definition at line 109 of file DDS_DicGroup.cxx.

{
  return myActiveSystem;
}
void DDS_DicGroup::GetKeys ( TColStd_SequenceOfAsciiString &  seq) const

Return all keys of the group.

Parameters:
seq- string container to be filled with keys

Definition at line 225 of file DDS_DicGroup.cxx.

{
  seq = myKeys;
}
TCollection_AsciiString DDS_DicGroup::GetName ( ) const

Get the name of group (component).

Returns:
group name

Definition at line 68 of file DDS_DicGroup.cxx.

{
  return myName;
}
TCollection_ExtendedString DDS_DicGroup::GetUnitSystemLabel ( const TCollection_AsciiString &  name) const

Get the label of units system name.

If units system is not found, empty string is returned.

Parameters:
makeunits system name
Returns:
units system label

Definition at line 97 of file DDS_DicGroup.cxx.

{
  TCollection_ExtendedString aLabel;
  if ( myUnitSystem.IsBound( name ) )
    aLabel = myUnitSystem.Find( name );
  return aLabel;
}
void DDS_DicGroup::GetUnitSystems ( TColStd_SequenceOfAsciiString &  theSystemSeq) const

Get the names of all defined units systems.

Parameters:
theSystemsSeqreturning sequence of names

Definition at line 77 of file DDS_DicGroup.cxx.

{
  theSystemSeq.Clear();
  for ( UnitSystemMap::Iterator it( myUnitSystem ); it.More(); it.Next() )
  {
    if ( it.Key() == TCollection_AsciiString( UNIT_SYSTEM_SI ) )
      theSystemSeq.Prepend( it.Key() );
    else
      theSystemSeq.Append( it.Key() );
  }
}

Here is the caller graph for this function:

Here is the caller graph for this function:

void DDS_DicGroup::operator= ( const DDS_DicGroup ) [private]

Assignment operator (put in private section to prevent object copying).

Definition at line 127 of file DDS_DicGroup.cxx.

{
}
void DDS_DicGroup::SetActiveUnitSystem ( const TCollection_AsciiString &  theSystem)

Set the active unit system.

Parameters:
theSystemname of the units system to be made active

Definition at line 118 of file DDS_DicGroup.cxx.

{
  if ( myUnitSystem.IsBound( theSystem ) )
    myActiveSystem = theSystem;
}

Friends And Related Function Documentation

friend class DDS_Dictionary [friend]

Definition at line 72 of file DDS_DicGroup.h.


Member Data Documentation

TCollection_AsciiString DDS_DicGroup::myActiveSystem [private]

Definition at line 69 of file DDS_DicGroup.h.

DDS_IndexedDataMapOfDicItems DDS_DicGroup::myDataMap [private]

Definition at line 67 of file DDS_DicGroup.h.

TColStd_SequenceOfAsciiString DDS_DicGroup::myKeys [private]

Definition at line 70 of file DDS_DicGroup.h.

TCollection_AsciiString DDS_DicGroup::myName [private]

Definition at line 66 of file DDS_DicGroup.h.

Definition at line 68 of file DDS_DicGroup.h.


The documentation for this class was generated from the following files: