libSBOL  2.3.3
Classes | Public Member Functions | List of all members
OwnedObject< SBOLClass > Class Template Reference

Detailed Description

template<class SBOLClass>
class sbol::OwnedObject< SBOLClass >

A container property that contains child objects.

Creates a composition out of two or more classes. In the SBOL specification, compositional relationships are indicated in class diagrams by arrows with black diamonds. A compositional relationship means that deleting the parent object will delete the child objects, and adding the parent object to a Document will also add the child object. Owned objects are stored in arbitrary order.

Template Parameters
SBOLClassThe type of child SBOL object contained by this Property

Classes

class  iterator
 Provides iterator functionality for SBOL properties that contain multiple objects. More...
 

Public Member Functions

 OwnedObject (void *property_owner, rdf_type sbol_uri, char lower_bound, char upper_bound, ValidationRules validation_rules, SBOLObject &first_object)
 Initialize a container and put the first object in it. More...
 
 OwnedObject (void *property_owner, rdf_type sbol_uri, char lower_bound, char upper_bound, ValidationRules validation_rules)
 Initialize a container property. More...
 
void set (SBOLClass &sbol_obj)
 
void add (SBOLClass &sbol_obj)
 
SBOLClass & get (const std::string uri="")
 Get the child object. More...
 
template<class SBOLSubClass >
SBOLSubClass & get (std::string uri="")
 Get the child object. More...
 
std::vector< SBOLClass * > getAll ()
 Get all the objects contained in the property. More...
 
SBOLClass & remove (std::string uri)
 Remove an object from the list of objects. More...
 
void remove (int index=0) override
 Remove an object from the list of objects and destroy it. More...
 
void clear () override
 Remove all children objects from the parent and destroy them.
 
SBOLClass & create (std::string uri)
 Autoconstructs a child object and attaches it to the parent object. More...
 
SBOLClass & define (SBOLObject &definition_object)
 Autoconstructs a child object and attaches it to the parent object. More...
 
template<class SBOLSubClass >
SBOLSubClass & create (std::string uri)
 
bool find (std::string uri) override
 
SBOLClass & operator[] (const int nIndex)
 Retrieve a child object by numerical index.
 
SBOLClass & operator[] (std::string uri)
 Retrieve a child object by URI.
 
virtual void set (std::string new_value)
 Basic setter for SBOL TextProperty and URIProperty. More...
 
virtual void set (int new_value)
 Basic setter for SBOL IntProperty, but can be used with TextProperty as well. More...
 
virtual void set (double new_value)
 Basic setter for SBOL IntProperty, but can be used with TextProperty as well. More...
 
void add (std::string new_value)
 Appends the new value to a list of values, for properties that allow it. More...
 
void copy (Property< SBOLClass > &target_property)
 Copy property values to a target object's property fields.
 

Constructor & Destructor Documentation

◆ OwnedObject() [1/2]

OwnedObject ( void *  property_owner,
rdf_type  sbol_uri,
char  lower_bound,
char  upper_bound,
ValidationRules  validation_rules,
SBOLObject first_object 
)

Initialize a container and put the first object in it.

Validation rules are checked upon initialization.

Parameters
type_uriAn RDF type for the property which determines how the property is serialized in SBOL files
lower_boundA char flag (typically '0' or '1') indicating the minimum number of values allowed for this property
upper_boundA char flag (typically '1' or '*') indicating the maximum number of values allowed for this property
validation_rulesA vector of pointers to the validation functions

◆ OwnedObject() [2/2]

OwnedObject ( void *  property_owner,
rdf_type  sbol_uri,
char  lower_bound,
char  upper_bound,
ValidationRules  validation_rules 
)

Initialize a container property.

No validation rules are run upon initialization.

Parameters
type_uriAn RDF type for the property which determines how the property is serialized in SBOL files
lower_boundA char flag (typically '0' or '1') indicating the minimum number of values allowed for this property
upper_boundA char flag (typically '1' or '*') indicating the maximum number of values allowed for this property
validation_rulesA vector of pointers to the validation functions

Member Function Documentation

◆ add() [1/2]

void add ( std::string  new_value)
inherited

Appends the new value to a list of values, for properties that allow it.

Parameters
new_valueA new string which will be added to a list of values.

◆ add() [2/2]

void add ( SBOLClass &  sbol_obj)
Template Parameters
SBOLClassThe type of SBOL object contained in this OwnedObject property
Parameters
sbol_objA child object to add to this container property. Adds a child object to the parent object. This method always appends another object to those already contained in this OwnedObject property. In SBOLCompliant mode, the create method is preferred

◆ create() [1/2]

SBOLSubClass & create ( std::string  uri)

Autoconstructs a child object and attaches it to the parent object.

The new object will be constructed with default values specified in the constructor for this type of object. If SBOLCompliance is enabled, the child object's identity will be constructed using the supplied displayId argument. Otherwise, the user should supply a full URI.

Template Parameters
SBOLClassThe type of SBOL object that will be created
Parameters
uriIf SBOLCompliance is enabled, this should be the displayId for the new child object. If not enabled, this should be a full raw URI.
Returns
A reference to the child object check uniqueness of URI in Document

◆ create() [2/2]

SBOLSubClass& create ( std::string  uri)
Template Parameters
SBOLClassThe type of SBOL object contained in this OwnedObject property
SBOLSubClassA derived class of SBOLClass. Use this specialization for OwnedObject properties which contain multiple types of SBOLObjects.
Parameters
uriIf SBOLCompliance is enabled, this should be the displayId for the new child object. If not enabled, this should be a full raw URI.
Returns
A reference to the child object Autoconstructs a child object and attaches it to the parent object. The new object will be constructed with default values specified in the constructor for this type of object. If SBOLCompliance is enabled, the child object's identity will be constructed using the supplied displayId argument. Otherwise, the user should supply a full URI. check uniqueness of URI in Document

◆ define()

SBOLClass & define ( SBOLObject definition_object)

Autoconstructs a child object and attaches it to the parent object.

Additionally, it sets the definition property of the child object, for example, in the case of creating Components, FunctionalComponents, and Modules. The new object will be constructed with default values specified in the constructor for this type of object. If SBOLCompliance is enabled, the child object's identity will be constructed using the supplied displayId argument. Otherwise, the user should supply a full URI.

Template Parameters
SBOLClassThe type of SBOL object that will be created
Parameters
definition_objectThe returned object will reference the definition_object in its definition property.
Returns
A reference to the child object check uniqueness of URI in Document

◆ find()

bool find ( std::string  uri)
overridevirtual
Parameters
uriThe full uniform resource identifier of the object to search for in this property
Returns
A boolean indicating whether found or not

Reimplemented from Property< SBOLClass >.

◆ get() [1/2]

SBOLSubClass & get ( const std::string  uri = "")

Get the child object.

Template Parameters
SBOLClassThe type of SBOL object contained in this OwnedObject property
SBOLSubClassA derived class of SBOLClass. Use this type specialization when adding multiple types of SBOLObjects to a container.
Parameters
sbol_objA child object to add to this container property. Adds a child object to the parent object. This method always appends another object to those already contained in this OwnedObject property. In SBOLCompliant mode, the create method is preferred
Template Parameters
SBOLClassThe type of the child object
Parameters
uriThe URI of the child object
Returns
A reference to the child object By default returns the first object in this OwnedObject container property

◆ get() [2/2]

SBOLSubClass& get ( std::string  uri = "")

Get the child object.

Template Parameters
SBOLClassThe type of the child object
SBOLSubClassA derived class of SBOLClass. Use this type specialization when adding multiple types of SBOLObjects to a container.
Parameters
uriThe specific URI for a child object if this OwnedObject property contains multiple objects,
Returns
A reference to the child object Returns a child object from the OwnedObject property. If no URI is specified, the first object in this OwnedObject property is returned.

◆ getAll()

std::vector< SBOLClass * > getAll ( )

Get all the objects contained in the property.

Returns
A vector of pointers to the objects

◆ remove() [1/2]

SBOLClass & remove ( std::string  uri)

Remove an object from the list of objects.

Parameters
uriThis can be a displayId of the object or a full URI may be provided.

◆ remove() [2/2]

void remove ( int  index = 0)
overridevirtual

Remove an object from the list of objects and destroy it.

Parameters
indexA numerical index for the object.

Reimplemented from Property< SBOLClass >.

◆ set() [1/4]

void set ( std::string  new_value)
virtualinherited

Basic setter for SBOL TextProperty and URIProperty.

Parameters
new_valueA new string value for the Property.

◆ set() [2/4]

void set ( int  new_value)
virtualinherited

Basic setter for SBOL IntProperty, but can be used with TextProperty as well.

Parameters
new_valueA new integer value for the property, which is converted to a raw string during serialization.

◆ set() [3/4]

void set ( double  new_value)
virtualinherited

Basic setter for SBOL IntProperty, but can be used with TextProperty as well.

Parameters
new_valueA new integer value for the property, which is converted to a raw string during serialization.

◆ set() [4/4]

void set ( SBOLClass &  sbol_obj)
Template Parameters
SBOLClassThe type of SBOL object contained in this OwnedObject property
Parameters
sbol_objA child object to add to this container property. Assigns a child object to this OwnedObject container property. This method always overwrites the first SBOLObject in the container. appends another object to those already contained in this OwnedObject property. In SBOLCompliant mode, the create method is preferred
sbol_objThe child object Sets the first object in the container

The documentation for this class was generated from the following files:
Inheritance diagram for OwnedObject< SBOLClass >:
Inheritance graph