OpenStudio:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
List of all members
openstudio::LocalBCL Class Reference

#include <LocalBCL.hpp>

+ Inheritance diagram for openstudio::LocalBCL:

Public Member Functions

Inherited members
virtual boost::optional
< BCLComponent
getComponent (const std::string &uid, const std::string &versionId="") const override
 Get the component by uid. More...
 
virtual boost::optional
< BCLMeasure
getMeasure (const std::string &uid, const std::string &versionId="") const override
 Get the measure by uid. More...
 
std::vector< BCLComponentcomponents () const
 Get all components. More...
 
std::vector< BCLMeasuremeasures () const
 Get all measures. More...
 
std::vector< std::string > measureUids () const
 Get all measure uids. More...
 
std::vector< BCLComponentsearchComponents (const std::string &searchTerm, const std::string &componentType) const
 Perform a component search of the library. More...
 
std::vector< BCLComponentsearchComponents (const std::string &searchTerm, const unsigned componentTypeTID) const
 
virtual std::vector< BCLMeasuresearchMeasures (const std::string &searchTerm, const std::string &componentType) const
 Perform a measure search of the library. More...
 
virtual std::vector< BCLMeasuresearchMeasures (const std::string &searchTerm, const unsigned componentTypeTID) const
 
- Public Member Functions inherited from openstudio::BCL
virtual ~BCL ()
 Virtual destructor. More...
 

Static Public Member Functions

Constructor
static LocalBCLinstance ()
 Static method to retrieve the current local BCL singleton If a local BCL singleton does not exist, one will be created at the default library path stored in user preferences. More...
 
static LocalBCLinstance (const path &libraryPath)
 Static method to retrieve the local BCL singleton at the given library path If a local BCL singleton does not exist, one will be created at the given library path If a local BCL singleton does exist, but is not at the given path, the current one will be closed and a new one will be created at the given library path. More...
 

Destructors

static void close ()
 Static method to close the current local BCL singleton if it exists. More...
 
virtual ~LocalBCL ()
 virtual destructor More...
 

Class members

bool prodAuthKeyUserPrompt * parent
 Prompt the user for auth key using a modal dialog, this is a blocking call that requires user input. More...
 
bool devAuthKeyUserPrompt * parent
 
bool addComponent (BCLComponent &component)
 Add a component to the local library. More...
 
bool removeComponent (BCLComponent &component)
 Remove a component from the local library and delete its directory. More...
 
bool addMeasure (BCLMeasure &measure)
 Add a measure to the local library. More...
 
bool removeMeasure (BCLMeasure &measure)
 Remove a measure from the local library and delete its directory. More...
 
std::vector< BCLComponentcomponentAttributeSearch (const std::vector< std::pair< std::string, std::string > > &searchTerms) const
 Search for components with attributes matching those in searchTerms. More...
 
std::vector< BCLMeasuremeasureAttributeSearch (const std::vector< std::pair< std::string, std::string > > &searchTerms) const
 Search for measures with attributes matching those in searchTerms. More...
 
std::string prodAuthKey () const
 Return production OAuth key. More...
 
bool setProdAuthKey (const std::string &prodAuthKey)
 Set the production OAuth key, validates the auth key before saving. More...
 
std::string devAuthKey () const
 Return development OAuth key. More...
 
bool setDevAuthKey (const std::string &devAuthKey)
 Set the development OAuth key, validates the auth key before saving. More...
 
QString libraryPath () const
 Returns the path to the local BCL library. More...
 
bool setLibraryPath (const std::string &libraryPath)
 Relocates the local BCL library, stores the library path in user preferences. More...
 

Additional Inherited Members

- Protected Member Functions inherited from openstudio::BCL
 BCL (QObject *parent=nullptr)
 Default constructor. More...
 

Detailed Description

Todo:
This class is currently a singleton implemented with a first use static this may cause problems with threading in the future and should be moved into some other singleton implementation. ONE OPTION would be to instantiate the singleton at the time of QApplication construction in the Application singleton this would avoid all known problems with threading. The Singleton<> template cannot be used because of static initialize and destruction order problems caused by statics used in the QDatabase stuff

Constructor & Destructor Documentation

virtual openstudio::LocalBCL::~LocalBCL ( )
virtual

virtual destructor

Member Function Documentation

bool openstudio::LocalBCL::addComponent ( BCLComponent component)

Add a component to the local library.

bool openstudio::LocalBCL::addMeasure ( BCLMeasure measure)

Add a measure to the local library.

static void openstudio::LocalBCL::close ( )
static

Static method to close the current local BCL singleton if it exists.

std::vector<BCLComponent> openstudio::LocalBCL::componentAttributeSearch ( const std::vector< std::pair< std::string, std::string > > &  searchTerms) const

Search for components with attributes matching those in searchTerms.

std::vector<BCLComponent> openstudio::LocalBCL::components ( ) const

Get all components.

std::string openstudio::LocalBCL::devAuthKey ( ) const

Return development OAuth key.

virtual boost::optional<BCLComponent> openstudio::LocalBCL::getComponent ( const std::string &  uid,
const std::string &  versionId = "" 
) const
overridevirtual

Get the component by uid.

Implements openstudio::BCL.

virtual boost::optional<BCLMeasure> openstudio::LocalBCL::getMeasure ( const std::string &  uid,
const std::string &  versionId = "" 
) const
overridevirtual

Get the measure by uid.

Implements openstudio::BCL.

static LocalBCL& openstudio::LocalBCL::instance ( )
static

Static method to retrieve the current local BCL singleton If a local BCL singleton does not exist, one will be created at the default library path stored in user preferences.

static LocalBCL& openstudio::LocalBCL::instance ( const path &  libraryPath)
static

Static method to retrieve the local BCL singleton at the given library path If a local BCL singleton does not exist, one will be created at the given library path If a local BCL singleton does exist, but is not at the given path, the current one will be closed and a new one will be created at the given library path.

QString openstudio::LocalBCL::libraryPath ( ) const

Returns the path to the local BCL library.

std::vector<BCLMeasure> openstudio::LocalBCL::measureAttributeSearch ( const std::vector< std::pair< std::string, std::string > > &  searchTerms) const

Search for measures with attributes matching those in searchTerms.

std::vector<BCLMeasure> openstudio::LocalBCL::measures ( ) const

Get all measures.

std::vector<std::string> openstudio::LocalBCL::measureUids ( ) const

Get all measure uids.

std::string openstudio::LocalBCL::prodAuthKey ( ) const

Return production OAuth key.

bool openstudio::LocalBCL::removeComponent ( BCLComponent component)

Remove a component from the local library and delete its directory.

bool openstudio::LocalBCL::removeMeasure ( BCLMeasure measure)

Remove a measure from the local library and delete its directory.

std::vector<BCLComponent> openstudio::LocalBCL::searchComponents ( const std::string &  searchTerm,
const std::string &  componentType 
) const

Perform a component search of the library.

std::vector<BCLComponent> openstudio::LocalBCL::searchComponents ( const std::string &  searchTerm,
const unsigned  componentTypeTID 
) const
virtual std::vector<BCLMeasure> openstudio::LocalBCL::searchMeasures ( const std::string &  searchTerm,
const std::string &  componentType 
) const
virtual

Perform a measure search of the library.

virtual std::vector<BCLMeasure> openstudio::LocalBCL::searchMeasures ( const std::string &  searchTerm,
const unsigned  componentTypeTID 
) const
virtual
bool openstudio::LocalBCL::setDevAuthKey ( const std::string &  devAuthKey)

Set the development OAuth key, validates the auth key before saving.

bool openstudio::LocalBCL::setLibraryPath ( const std::string &  libraryPath)

Relocates the local BCL library, stores the library path in user preferences.

bool openstudio::LocalBCL::setProdAuthKey ( const std::string &  prodAuthKey)

Set the production OAuth key, validates the auth key before saving.

Member Data Documentation

bool prodAuthKeyUserPrompt* openstudio::LocalBCL::parent

Prompt the user for auth key using a modal dialog, this is a blocking call that requires user input.

If user enters input returns the value of setAuthKey, otherwise returns false

bool devAuthKeyUserPrompt* openstudio::LocalBCL::parent