tsc_EntityFeatures

Description

tsc_EntityFeatures is the container for the features and attributes that may be attached to a database entity such as a point or line.  A tsc_EntityFeatures contains a list of features, each of which has a name and a list of attributes.  Each attribute is a name/value pair.  A typical entity's features and attributes might be organised into a hierarchy like this:

tsc_EntityFeatures
    tsc_FeatureList
        tsc_Feature        (eg EchoSounder)
            tsc_NumberAttribute  (eg, DepthMeters)
            tsc_NumberAttribute  (eg, WaterTempC)

Each attribute contains a Type (integer, text, number, date, etc), a name, and a value of the correct type.

Any reasonable number of features and attributes may be assembled into a tsc_EntityFeatures object, and stored in the database as an attachment to a point, line, etc. The tsc_Observation class allows a tsc_EntityFeatures to be attached to a new point before it is stored.  The tsc_Database class allows a tsc_EntityFeatures to be attached to an existing entity, and tsc_Entity allows the features of an existing entity to be obtained as a tsc_EntityFeatures object.

Related classes

Also see Features and attributes for an overview of the system.

Public constructors

tsc_EntityFeatures ();
Constructs an empty object.

tsc_EntityFeatures (const tsc_EntityFeatures&);
Constructs a reference to the same object.

Public methods

bool Exists () const;
True if the instance refers to an existing object, otherwise false.  This is useful, for instance, to find out whether an entity has any features after calling tsc_Entity::Features().

bool HasFeatures () const;
Returns true if the feature list contains one or more features.

bool HasAttributes () const;
Returns true if any features contain attributes.

tsc_String MakeFeatureCodeString() const;
Creates a feature code string suitable for an entity code field.  It is not generally necessary to set the code field of a database entity when features are being attached, since the code field will be automatically overwritten with a space-separated list of feature codes when the database is updated.

tsc_Attribute FindAttribute (const char* featureName, const char* attributeName) const;
This is a convenience method that finds the feature of the supplied name, and returns the named attribute within that feature.  If either object is not found, the IsNull() method of the returned tsc_Attribute will return false.

tsc_EntityFeatures& operator= (const tsc_EntityFeatures&);
Assignment makes a reference to the same tsc_EntityFeatures object.

tsc_EntityFeatures Clone () const;
Makes a deep copy of the entire object and all its members.

Public members

tsc_FeatureList Features;
This object is the list of features in the object. Searches and modifications to the features and attributes are made through this object.