OpenStudioCore:model
 AllClasses Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages

#include "Component.hpp"

Inheritance diagram for openstudio::model::Component:

Public Member Functions

 Component (const openstudio::IdfFile &idfFile)
virtual ~Component ()
ComponentData componentData () const
ModelObject primaryObject () const

Protected Member Functions

 Component (const std::vector< ModelObject > &contents)

Related Functions

typedef std::vector< ComponentComponentVector
typedef boost::optional
< Component
OptionalComponent

Serialization

virtual bool save (const openstudio::path &p, bool overwrite=false)
static boost::optional< Componentload (const path &p)

Detailed Description

Component is a Model that contains exactly one ComponentData object.

All objects other than the ComponentData object and the version object are the Component contents. There is a primary ModelObject that provides the Component's type. There are no public constructors, as Components are to be constructed through the ModelObject method createComponent. Similarly, Model-level object addition and removal, and SqlFile functionality, has been disabled.

Constructor & Destructor Documentation

openstudio::model::Component::Component ( const openstudio::IdfFile idfFile)
explicit

Construct from an IdfFile.

Must contain exactly one ComponentData object, and contents list in ComponentData must exactly match the contents of idfFile.

virtual openstudio::model::Component::~Component ( )
virtual
openstudio::model::Component::Component ( const std::vector< ModelObject > &  contents)
protected

Construct from a vector of ModelObjects, all in the same .model().

The primary object must be listed first. Throws if contents.empty() or if more than one .model() is found. StrictnessLevel is always set to Draft. Not for general use; used by ModelObject::createComponent.

Member Function Documentation

ComponentData openstudio::model::Component::componentData ( ) const

Returns the object that contains the contents list, unique identifiers, and timestamps for this Component.

static boost::optional<Component> openstudio::model::Component::load ( const path &  p)
static

Load Component from path p, if possible.

ModelObject openstudio::model::Component::primaryObject ( ) const

Returns the primary ModelObject of this Component.

Can be used to access the Component type by using .optionalCast or iddObjectType().

virtual bool openstudio::model::Component::save ( const openstudio::path &  p,
bool  overwrite = false 
)
virtual

Save Component to path p.

Will construct the parent folder if its parent folder exists. An existing file will only be overwritten if if overwrite==true. If no extension is provided, componentFileExtension() will be used.

Friends And Related Function Documentation

typedef std::vector<Component> ComponentVector
related
typedef boost::optional<Component> OptionalComponent
related