OpenStudioCore:utilities
 All Classes Namespaces Functions Variables Typedefs Enumerations Enumerator Friends Pages
Public Member Functions | Protected Member Functions | List of all members
openstudio::WorkspaceObjectOrder Class Reference

#include <WorkspaceObjectOrder.hpp>

Public Member Functions

boost::optional< std::vector
< Handle > > 
directOrder () const
 returns the direct order. return value is false if not ordering this way. More...
 
bool erase (IddObjectType type)
 returns false if not ordering by user-specified IddObjectType, or request is otherwise invalid. More...
 
bool erase (const Handle &handle)
 returns false if not ordering directly, or request is otherwise invalid More...
 
boost::optional< std::vector
< IddObjectType > > 
iddOrder () const
 returns the user-specified order of IddObjectTypes. More...
 
boost::optional< unsigned > indexInOrder (const Handle &handle) const
 Returns index of handle in order, if its order is directly specified. More...
 
bool inOrder (const Handle &handle) const
 Returns whether order of handle is directly specified. More...
 
bool insert (IddObjectType type, IddObjectType insertBeforeType)
 returns false if not ordering by user-specified IddObjectType order. More...
 
bool insert (IddObjectType type, unsigned index)
 returns false if not ordering by user-specified IddObjectType order. More...
 
bool insert (const Handle &handle, const Handle &insertBeforeHandle)
 returns false if not ordering directly More...
 
bool insert (const Handle &handle, unsigned index)
 returns false if not ordering directly More...
 
bool isDirectOrder () const
 Returns whether or not direct ordered. Otherwise, is ordered by IddObjectType. More...
 
bool move (IddObjectType type, IddObjectType insertBeforeType)
 move type from current location and place before 'insertBeforeType'. More...
 
bool move (IddObjectType type, unsigned index)
 move type from current location to index. More...
 
bool move (const Handle &handle, const Handle &insertBeforeHandle)
 returns false if not ordering directly, or request is otherwise invalid More...
 
bool move (const Handle &handle, unsigned index)
 returns false if not ordering directly, or request is otherwise invalid More...
 
bool orderByIddEnum () const
 returns whether or not currently ordering by IddObjectType More...
 
bool push_back (IddObjectType type)
 returns false if not ordering by user-specified IddObjectType order, or request is otherwise invalid. More...
 
bool push_back (const Handle &handle)
 returns false if not ordering directly More...
 
void setDirectOrder (const std::vector< Handle > &order)
 deletes other ordering options and sets direct order More...
 
void setIddOrder (const std::vector< IddObjectType > &order)
 deletes other ordering options and sets IddObjectType order More...
 
void setOrderByIddEnum ()
 deletes other ordering options and orders by IddObjectType More...
 
std::vector< Handle > sort (const std::vector< Handle > &handles) const
 
std::vector
< openstudio::WorkspaceObject
sort (const std::vector< openstudio::WorkspaceObject > &objects) const
 
bool swap (IddObjectType type1, IddObjectType type2)
 returns false if not ordering by user-specified IddObjectType, or request is otherwise invalid. More...
 
bool swap (const Handle &handle1, const Handle &handle2)
 returns false if not ordering directly, or request is otherwise invalid More...
 
virtual ~WorkspaceObjectOrder ()
 

Protected Member Functions

 WorkspaceObjectOrder (const std::shared_ptr< detail::WorkspaceObjectOrder_Impl > &impl)
 

Detailed Description

Public interface of WorkspaceObjectOrder.

Accessed through Workspace as in:

WorkspaceObjectOrder orderer = workspace.order();

This interface is provided to let users specify the order in which objects and handles are returned by Workspace. Sorting is accessed through the workspace itself. For instance,

ws.objects(true)

Constructor & Destructor Documentation

virtual openstudio::WorkspaceObjectOrder::~WorkspaceObjectOrder ( )
inlinevirtual
openstudio::WorkspaceObjectOrder::WorkspaceObjectOrder ( const std::shared_ptr< detail::WorkspaceObjectOrder_Impl > &  impl)
protected

Member Function Documentation

boost::optional< std::vector<Handle> > openstudio::WorkspaceObjectOrder::directOrder ( ) const

returns the direct order. return value is false if not ordering this way.

bool openstudio::WorkspaceObjectOrder::erase ( IddObjectType  type)

returns false if not ordering by user-specified IddObjectType, or request is otherwise invalid.

bool openstudio::WorkspaceObjectOrder::erase ( const Handle &  handle)

returns false if not ordering directly, or request is otherwise invalid

boost::optional< std::vector<IddObjectType> > openstudio::WorkspaceObjectOrder::iddOrder ( ) const

returns the user-specified order of IddObjectTypes.

return value is false if not ordering this way.

boost::optional<unsigned> openstudio::WorkspaceObjectOrder::indexInOrder ( const Handle &  handle) const

Returns index of handle in order, if its order is directly specified.

bool openstudio::WorkspaceObjectOrder::inOrder ( const Handle &  handle) const

Returns whether order of handle is directly specified.

bool openstudio::WorkspaceObjectOrder::insert ( IddObjectType  type,
IddObjectType  insertBeforeType 
)

returns false if not ordering by user-specified IddObjectType order.

bool openstudio::WorkspaceObjectOrder::insert ( IddObjectType  type,
unsigned  index 
)

returns false if not ordering by user-specified IddObjectType order.

bool openstudio::WorkspaceObjectOrder::insert ( const Handle &  handle,
const Handle &  insertBeforeHandle 
)

returns false if not ordering directly

bool openstudio::WorkspaceObjectOrder::insert ( const Handle &  handle,
unsigned  index 
)

returns false if not ordering directly

bool openstudio::WorkspaceObjectOrder::isDirectOrder ( ) const

Returns whether or not direct ordered. Otherwise, is ordered by IddObjectType.

bool openstudio::WorkspaceObjectOrder::move ( IddObjectType  type,
IddObjectType  insertBeforeType 
)

move type from current location and place before 'insertBeforeType'.

returns false if not ordering by user-specified IddObjectType order, or request is otherwise invalid. type must already be in the order. if insertBeforeType is not in the ordering, places type at the end.

bool openstudio::WorkspaceObjectOrder::move ( IddObjectType  type,
unsigned  index 
)

move type from current location to index.

returns false if not ordering by user-specified IddObjectType order, or request is otherwise invalid. type must already be in the order. if index is invalid, places type at the end.

bool openstudio::WorkspaceObjectOrder::move ( const Handle &  handle,
const Handle &  insertBeforeHandle 
)

returns false if not ordering directly, or request is otherwise invalid

bool openstudio::WorkspaceObjectOrder::move ( const Handle &  handle,
unsigned  index 
)

returns false if not ordering directly, or request is otherwise invalid

bool openstudio::WorkspaceObjectOrder::orderByIddEnum ( ) const

returns whether or not currently ordering by IddObjectType

bool openstudio::WorkspaceObjectOrder::push_back ( IddObjectType  type)

returns false if not ordering by user-specified IddObjectType order, or request is otherwise invalid.

bool openstudio::WorkspaceObjectOrder::push_back ( const Handle &  handle)

returns false if not ordering directly

void openstudio::WorkspaceObjectOrder::setDirectOrder ( const std::vector< Handle > &  order)

deletes other ordering options and sets direct order

void openstudio::WorkspaceObjectOrder::setIddOrder ( const std::vector< IddObjectType > &  order)

deletes other ordering options and sets IddObjectType order

void openstudio::WorkspaceObjectOrder::setOrderByIddEnum ( )

deletes other ordering options and orders by IddObjectType

std::vector<Handle> openstudio::WorkspaceObjectOrder::sort ( const std::vector< Handle > &  handles) const
std::vector<openstudio::WorkspaceObject> openstudio::WorkspaceObjectOrder::sort ( const std::vector< openstudio::WorkspaceObject > &  objects) const
bool openstudio::WorkspaceObjectOrder::swap ( IddObjectType  type1,
IddObjectType  type2 
)

returns false if not ordering by user-specified IddObjectType, or request is otherwise invalid.

bool openstudio::WorkspaceObjectOrder::swap ( const Handle &  handle1,
const Handle &  handle2 
)

returns false if not ordering directly, or request is otherwise invalid