CAD Exchanger SDK
cadex::ModelData_PropertyTable Class Reference

Defines a collection of properties. More...

Inheritance diagram for cadex::ModelData_PropertyTable:
cadex::ModelData_BaseObject

Classes

class  Provider
 Provides properties to the property table. More...
 
struct  TimeType
 Defines a type to represent time. More...
 
class  Visitor
 Visitor of the properties in the table. More...
 

Public Types

typedef const Base_UTF16StringPropertyNameConstReference
 
typedef cadex::internal::ModelData_PropertyTableImpl ImplType
 
typedef time_t TimeVal
 
- Public Types inherited from cadex::ModelData_BaseObject
typedef int IdType
 Defines a type identifier.
 

Public Member Functions

 ModelData_PropertyTable (initialized)
 
 ModelData_PropertyTable (ImplType *theImpl)
 Constructor (reserved for internal use).
 
void Add (const Base_UTF16String &theName, I32 theValue)
 
void Add (const Base_UTF16String &theName, I64 theValue)
 
void Add (const Base_UTF16String &theName, float theValue)
 
void Add (const Base_UTF16String &theName, double theValue)
 
void Add (const Base_UTF16String &theName, TimeType theValue)
 
void Add (const Base_UTF16String &theName, const Base_UTF16String &theValue)
 
void Add (const Base_UTF16String &theName, const ModelData_Point &theValue)
 
void Add (const Base_UTF16String &theName, const ModelData_Box &theValue)
 
void Add (const ModelData_PropertyTable &theTable)
 Appends properties from another property table.
 
void AddProvider (const std::shared_ptr< Provider > &theProvider)
 Adds a provider with a deleter. More...
 
bool HasProperty (const Base_UTF16String &theName, bool theFlushProviders=false) const
 Returns true if the table contains a property with a specified name.
 
bool IsEmpty () const
 Returns true if the property table is empty. More...
 
size_t Size () const
 Returns the number of added properties. More...
 
void Clear ()
 Discards associated data. More...
 
void Accept (Visitor &theVisitor) const
 Accepts the visitor. More...
 
bool FindProperty (const Base_UTF16String &theName, I32 &theValue, bool theFlushProviders=false) const
 
bool FindProperty (const Base_UTF16String &theName, I64 &theValue, bool theFlushProviders=false) const
 
bool FindProperty (const Base_UTF16String &theName, float &theValue, bool theFlushProviders=false) const
 
bool FindProperty (const Base_UTF16String &theName, double &theValue, bool theFlushProviders=false) const
 
bool FindProperty (const Base_UTF16String &theName, TimeType &theValue, bool theFlushProviders=false) const
 
bool FindProperty (const Base_UTF16String &theName, Base_UTF16String &theValue, bool theFlushProviders=false) const
 
bool FindProperty (const Base_UTF16String &theName, ModelData_Point &theValue, bool theFlushProviders=false) const
 
bool FindProperty (const Base_UTF16String &theName, ModelData_Box &theValue, bool theFlushProviders=false) const
 
bool Remove (const Base_UTF16String &theName, bool theFlushProviders=false)
 
- Public Member Functions inherited from cadex::ModelData_BaseObject
 ModelData_BaseObject ()
 Constructor. More...
 
IdType TypeId () const
 Returns an object type id. More...
 
template<typename T >
bool IsOfType () const
 Returns true if the object has a type T. More...
 
void SetName (const Base_UTF16String &theName)
 Sets an object name. More...
 
Base_UTF16String Name () const
 Returns an object name. More...
 
void Nullify ()
 Resets reference to implementation object. More...
 
bool IsNull () const
 Returns true if the object is nullified. More...
 
 operator bool () const
 Casts the object to the bool type. More...
 
internal::ModelData_BaseObjectImpl * Impl () const
 Return a handle to backend (reserved for internal use).
 

Static Public Member Functions

static IdType GetTypeId ()
 
static const Base_UTF16StringNamePropertyName ()
 Returns a key to designate a 'name' property. More...
 
static const Base_UTF16StringSurfaceAreaPropertyName ()
 Returns a key to designate a 'surface area' validation property. More...
 
static const Base_UTF16StringVolumePropertyName ()
 Returns a key to designate a 'volume' validation property. More...
 
static const Base_UTF16StringCentroidPropertyName ()
 Returns a key to designate a 'centroid' validation property. More...
 
static const Base_UTF16StringBoundingBoxPropertyName ()
 Returns a key to designate a 'bounding box' property. More...
 
static const Base_UTF16StringExternalFilenamePropertyName ()
 Returns a key to designate a 'external filename' validation property. More...
 

Additional Inherited Members

- Protected Member Functions inherited from cadex::ModelData_BaseObject
 ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl)
 Constructor (reserved for internal use).
 
 ModelData_BaseObject (const internal::ModelData_BaseObjectImpl *theImpl, const Base_UTF16String &theName)
 Constructor (reserved for internal use).
 
template<typename T >
T * GetOrCreateImpl ()
 Reserved for internal use.
 

Detailed Description

Defines a collection of properties.

Property table is a list of pairs {property_name, property_value}. A property name is defined with a Unicode string (Base_UTF16String). A value can have any of the following types:

  • integer (32- and 64-bit);
  • float;
  • double;
  • timestamp;
  • Unicode string;
  • 3D point;
  • 3D box.

In addition, validation properties (surface area, volume, centroid, etc) can be registered using reserved property names - see Validation properties.

A property table can be attached to any scene graph element (ModelData_SceneGraphElement subclass) or a subshape in ModelData_BRepRepresentation.

A property table can be checked with IsEmpty(), Size() and cleared with Clear() method.

HasProperty() checks if a property item has been registered in the table. Property items can be retrieved either using iterators, visitors or directly searching items by their names.

See also
Properties.
Examples:
exploring/propertytable/main.cxx, and modeling/metadata/main.cxx.

Member Function Documentation

◆ Accept()

void cadex::ModelData_PropertyTable::Accept ( ModelData_PropertyTable::Visitor theVisitor) const

Accepts the visitor.

The order of visiting will match the order of adding properties with Add().

If there providers added with AddProvider() then they will be flushed before starting visiting.

Examples:
exploring/propertytable/main.cxx.

◆ AddProvider()

void cadex::ModelData_PropertyTable::AddProvider ( const std::shared_ptr< Provider > &  theProvider)

Adds a provider with a deleter.

theProvider will be deleted with the specified deleter.

◆ BoundingBoxPropertyName()

const Base_UTF16String & cadex::ModelData_PropertyTable::BoundingBoxPropertyName ( )
static

Returns a key to designate a 'bounding box' property.

Returns "CADEX_BOUNDING_BOX".

◆ CentroidPropertyName()

const Base_UTF16String & cadex::ModelData_PropertyTable::CentroidPropertyName ( )
static

Returns a key to designate a 'centroid' validation property.

Returns "CADEX_CENTROID". The JT exporter will use this property to attach CAD_CENTER_OF_GRAVITY to an entity in the Logical Scene Graph.

◆ Clear()

void cadex::ModelData_PropertyTable::Clear ( )

Discards associated data.

Providers which have been added with their deleters will be deleted.

◆ ExternalFilenamePropertyName()

const Base_UTF16String & cadex::ModelData_PropertyTable::ExternalFilenamePropertyName ( )
static

Returns a key to designate a 'external filename' validation property.

Returns "External Filename". This value set by PartSaver and stores relative path to the external file.

◆ IsEmpty()

bool cadex::ModelData_PropertyTable::IsEmpty ( ) const

Returns true if the property table is empty.

Returns true if this object IsNull() or no property items or providers have been added.

See also
Size().

◆ NamePropertyName()

const Base_UTF16String & cadex::ModelData_PropertyTable::NamePropertyName ( )
static

Returns a key to designate a 'name' property.

Returns "Name". This value can be used by different algorithms to recognize this predefined property and distinguish it from others. For example, the JT exporter will use this property to set entity names in the Logical Scene Graph.

◆ Size()

size_t cadex::ModelData_PropertyTable::Size ( ) const

Returns the number of added properties.

Returns a number of items which were added with Add(). Does not take into account added providers (as a provider may add an arbitrary number of items).

Returns 0 if this object IsNull().

◆ SurfaceAreaPropertyName()

const Base_UTF16String & cadex::ModelData_PropertyTable::SurfaceAreaPropertyName ( )
static

Returns a key to designate a 'surface area' validation property.

Returns "CADEX_SURFACE_AREA". The JT exporter will use this property to attach CAD_SURFACE_AREA to an entity in the Logical Scene Graph.

◆ VolumePropertyName()

const Base_UTF16String & cadex::ModelData_PropertyTable::VolumePropertyName ( )
static

Returns a key to designate a 'volume' validation property.

Returns "CADEX_VOLUME". The JT exporter will use this property to attach CAD_VOLUME to an entity in the Logical Scene Graph.