COPASI API  4.40.278
CSlider Class Reference

#include <CSlider.h>

Inheritance diagram for CSlider:
[legend]

Public Types

enum  Scale { linear = 0 , logarithmic , undefinedScale }
 
enum  Type {
  Float = 0 , UnsignedFloat , Integer , UnsignedInteger ,
  Undefined
}
 
- Public Types inherited from CDataContainer
typedef CDataObjectMap objectMap
 
- Public Types inherited from CDataObject
typedef std::set< const CDataObject * > DataObjectSet
 
enum  Flag {
  Container , Vector , Matrix , NameVector ,
  Reference , ValueBool , ValueInt , ValueInt64 ,
  ValueDbl , NonUniqueName , StaticString , ValueString ,
  Separator , DisplayName , ModelEntity , Array ,
  DataModel , Root , Gui , __SIZE
}
 
- Public Types inherited from CObjectInterface
typedef std::vector< const CDataContainer * > ContainerList
 
typedef std::set< const CObjectInterface * > ObjectSet
 

Public Member Functions

virtual bool applyData (const CData &data, CUndoData::CChangeSet &changes)
 
bool compile (const CObjectInterface::ContainerList &listOfContainer)
 
Scale convertScaleNameToScale (const char *scaleName)
 
const char * convertScaleToScaleName (Scale scale) const
 
 CSlider (const CSlider &src, const CDataContainer *pParent)
 
 CSlider (const std::string &name="Slider", const CDataContainer *pParent=NO_PARENT)
 
const std::string & getAssociatedEntityKey () const
 
const std::string & getKey () const
 
const C_FLOAT64getMaxValue () const
 
const C_FLOAT64getMinValue () const
 
const C_FLOAT64getOriginalValue () const
 
Scale getScaling () const
 
const CDataObjectgetSliderObject () const
 
const std::string & getSliderObjectCN () const
 
CSlider::Type getSliderType () const
 
const C_FLOAT64getSliderValue () const
 
bool getSynced () const
 
unsigned C_INT32 getTickFactor () const
 
unsigned C_INT32 getTickNumber () const
 
bool isValid () const
 
void resetRange ()
 
void resetValue ()
 
bool setAssociatedEntityKey (const std::string &associatedEntityKey)
 
bool setMaxValue (const C_FLOAT64 maxValue)
 
bool setMinValue (const C_FLOAT64 minValue)
 
bool setOriginalValue (const C_FLOAT64 value)
 
bool setScaling (Scale scaling)
 
bool setSliderObject (const CCommonName &objectCN)
 
bool setSliderObject (const CDataObject *pObject)
 
bool setSliderType (const CSlider::Type type)
 
bool setSliderValue (const C_FLOAT64 value, const bool &writeToObject=true)
 
void setSynced (bool synced)
 
bool setTickFactor (const unsigned C_INT32 tickFactor)
 
bool setTickNumber (const unsigned C_INT32 tickNumber)
 
void sync ()
 
virtual CData toData () const
 
void writeToObject ()
 
 ~CSlider ()
 
- Public Member Functions inherited from CDataContainer
virtual bool add (CDataObject *pObject, const bool &adopt=true)
 
virtual bool appendDeletedDependentData (CUndoData &undoData) const
 
 CDataContainer (const CDataContainer &src, const CDataContainer *pParent)
 
 CDataContainer (const std::string &name, const CDataContainer *pParent=NO_PARENT, const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
virtual void createUndoData (CUndoData &undoData, const CUndoData::Type &type, const CData &oldData=CData(), const CCore::Framework &framework=CCore::Framework::ParticleNumbers) const override
 
virtual std::string getChildObjectUnits (const CDataObject *pObject) const
 
void getDescendants (CDataObject::DataObjectSet &descendants, const bool &recursive=false) const
 
virtual size_t getIndex (const CDataObject *pObject) const
 
virtual const CObjectInterfacegetObject (const CCommonName &cn) const override
 
virtual objectMapgetObjects ()
 
virtual const objectMapgetObjects () const
 
virtual const std::string getUnits () const override
 
virtual const CDataObjectgetValueObject () const override
 
virtual CUndoObjectInterfaceinsert (const CData &data) override
 
void objectRenamed (CDataObject *pObject, const std::string &oldName)
 
virtual bool remove (CDataObject *pObject)
 
virtual ~CDataContainer ()
 
- Public Member Functions inherited from CDataObject
void addIssue (const CIssue &issue)
 
void addReference (const CDataContainer *pReference)
 
virtual void calculateValue () override
 
 CDataObject (const CDataObject &src, const CDataContainer *pParent=NULL)
 
virtual void destruct () override
 
virtual CCommonName getCN () const override
 
virtual const CDataObjectgetDataObject () const override
 
CDataContainergetObjectAncestor (const std::string &type) const
 
CDataModelgetObjectDataModel () const
 
virtual std::string getObjectDisplayName () const override
 
const CObjectInterfacegetObjectFromCN (const CCommonName &cn) const
 
const std::string & getObjectName () const
 
CDataContainergetObjectParent () const
 
const std::string & getObjectType () const
 
virtual const CObjectInterface::ObjectSetgetPrerequisites () const override
 
virtual const CValiditygetValidity () const override
 
virtual void * getValuePointer () const override
 
bool hasFlag (const Flag &flag) const
 
virtual bool isPrerequisiteForContext (const CObjectInterface *pObject, const CCore::SimulationContextFlag &context, const CObjectInterface::ObjectSet &changedObjects) const override
 
bool prerequisitsContains (const DataObjectSet &objects) const
 
virtual void print (std::ostream *ostream) const override
 
void removeIssue (const CIssue &issue)
 
void removeReference (const CDataContainer *pReference)
 
bool setObjectName (const std::string &name)
 
virtual bool setObjectParent (const CDataContainer *pParent)
 
void validityChanged (const CValidity &changedValidity) override
 
void validityRemoved (const CValidity &changedValidity)
 
virtual ~CDataObject ()
 
- Public Member Functions inherited from CObjectInterface
 CObjectInterface ()
 
 CObjectInterface (const CObjectInterface &src)
 
virtual ~CObjectInterface ()
 
- Public Member Functions inherited from CUndoObjectInterface
 CUndoObjectInterface ()
 
 CUndoObjectInterface (const CUndoObjectInterface &src)
 
bool generateUuid ()
 
const xg::Guid & getUuid () const
 
bool setUuid (const std::string &uuid)
 
bool setUuid (const xg::Guid &uuid)
 
virtual void updateIndex (const size_t &index, const CUndoObjectInterface *pUndoObject)
 
virtual ~CUndoObjectInterface ()
 

Static Public Member Functions

static CSliderfromData (const CData &data, CUndoObjectInterface *pParent)
 
- Static Public Member Functions inherited from CDataContainer
static CDataContainerfromData (const CData &data, CUndoObjectInterface *pParent)
 
- Static Public Member Functions inherited from CDataObject
static CDataObjectfromData (const CData &data, CUndoObjectInterface *pParent)
 
static void sanitizeObjectName (std::string &name)
 
- Static Public Member Functions inherited from CObjectInterface
static const CDataObjectDataObject (const CObjectInterface *pInterface)
 
static CObjectInterfaceGetObjectFromCN (const ContainerList &listOfContainer, const CCommonName &objName)
 
- Static Public Member Functions inherited from CUndoObjectInterface
template<class CType >
static CType * fromData (const CData &, CUndoObjectInterface *)
 

Static Public Attributes

static const char * ScaleName []
 
static const char * TypeName []
 
- Static Public Attributes inherited from CDataContainer
static const CObjectInterface::ContainerList EmptyList
 

Private Attributes

std::string mAssociatedEntityKey
 
CRegisteredCommonName mCN
 
CCore::CUpdateSequence mInitialRefreshes
 
std::string mKey
 
C_FLOAT64 mMaxValue
 
C_FLOAT64 mMinValue
 
C_FLOAT64 mOriginalValue
 
CDataObjectmpSliderObject
 
Scale mScaling
 
Type mSliderType
 
bool mSync
 
unsigned C_INT32 mTickFactor
 
unsigned C_INT32 mTickNumber
 
C_FLOAT64 mValue
 

Additional Inherited Members

- Protected Member Functions inherited from CDataContainer
template<class CType >
CDataMatrixReference< CType > * addMatrixReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataObjectReference< CType > * addObjectReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
template<class CType >
CDataVectorReference< CType > * addVectorReference (const std::string &name, CType &reference, const CFlags< Flag > &flag=CFlags< Flag >::None)
 
 CDataContainer (const CDataContainer &src)
 
void initObjects ()
 
- Protected Member Functions inherited from CDataObject
 CDataObject ()
 
 CDataObject (const std::string &name, const CDataContainer *pParent=static_cast< CDataContainer * >((void *) 0), const std::string &type="CN", const CFlags< Flag > &flag=CFlags< Flag >::None)
 
- Protected Attributes inherited from CDataContainer
objectMap mObjects
 
- Protected Attributes inherited from CDataObject
ObjectSet mPrerequisits
 
std::set< CDataContainer * > mReferences
 
- Protected Attributes inherited from CObjectInterface
CValidity mValidity
 

Member Enumeration Documentation

◆ Scale

Enum of valid scales

Enumerator
linear 
logarithmic 
undefinedScale 

◆ Type

Enum of valid quantity units

Enumerator
Float 
UnsignedFloat 
Integer 
UnsignedInteger 
Undefined 

Constructor & Destructor Documentation

◆ CSlider() [1/2]

CSlider::CSlider ( const std::string &  name = "Slider",
const CDataContainer pParent = NO_PARENT 
)

Default constructor

Parameters
conststd::string & name (default: "NoName")
constCDataContainer * pParent (default: NULL)

Referenced by fromData().

◆ CSlider() [2/2]

CSlider::CSlider ( const CSlider src,
const CDataContainer pParent 
)

Copy constructor

Parameters
constCSlider & src
constCDataContainer * pParent (default: NULL)

◆ ~CSlider()

CSlider::~CSlider ( )

Member Function Documentation

◆ applyData()

bool CSlider::applyData ( const CData data,
CUndoData::CChangeSet changes 
)
virtual

Apply the provided data to the object

Parameters
constCData & data
Returns
bool success

Reimplemented from CDataContainer.

References fatalError.

◆ compile()

bool CSlider::compile ( const CObjectInterface::ContainerList listOfContainer)

Compile, i.e., find the objects pointed to by the CN.

Parameters
constCObjectInterface::ContainerList & listOfContainer (default: CDataContainer::EmptyList)
Returns
bool success

References CObjectInterface::DataObject(), CDataObject::getObjectDataModel(), CObjectInterface::GetObjectFromCN(), mCN, mpSliderObject, mSync, setSliderObject(), and sync().

◆ convertScaleNameToScale()

CSlider::Scale CSlider::convertScaleNameToScale ( const char *  scaleName)

Converts the scaling name to the corresponding enum.

Returns
CSlider::Scale

References linear, logarithmic, and undefinedScale.

Referenced by SliderHandler::processStart().

◆ convertScaleToScaleName()

const char * CSlider::convertScaleToScaleName ( Scale  scale) const

Converts the scaling name to the corresponding enum.

Returns
const char* scaleName

References ScaleName, and undefinedScale.

Referenced by CCopasiXML::saveGUI().

◆ fromData()

CSlider * CSlider::fromData ( const CData data,
CUndoObjectInterface pParent 
)
static

Static method to create a CDataObject based on the provided data

Parameters
constCData & data
Returns
CSlider * pDataObject

References CSlider(), CData::getProperty(), NO_PARENT, CData::OBJECT_NAME, and CDataValue::toString().

◆ getAssociatedEntityKey()

const std::string & CSlider::getAssociatedEntityKey ( ) const

Retrieve the key of the associated entity.

Returns
const std::string & associatedEntityKey

References mAssociatedEntityKey.

Referenced by CCopasiXML::saveGUI().

◆ getKey()

const std::string & CSlider::getKey ( ) const
virtual

Retrieve the key

Returns
const std::string & key

Reimplemented from CDataObject.

References mKey.

Referenced by CCopasiXML::saveGUI().

◆ getMaxValue()

const C_FLOAT64 & CSlider::getMaxValue ( ) const

Retrieve the slider maximum value.

Returns
const C_FLOAT64 & maxValue

References mMaxValue.

Referenced by CCopasiXML::saveGUI().

◆ getMinValue()

const C_FLOAT64 & CSlider::getMinValue ( ) const

Retrieve the slider minimum value.

Returns
const C_FLOAT64 minValue

References mMinValue.

Referenced by CCopasiXML::saveGUI().

◆ getOriginalValue()

const C_FLOAT64 & CSlider::getOriginalValue ( ) const

Retrieve the original slider Value.

Returns
const C_FLOAT64 Value

References mOriginalValue.

◆ getScaling()

CSlider::Scale CSlider::getScaling ( ) const

Retrieve the scaling of the slider.

Returns
Scale scaling

References mScaling.

Referenced by CCopasiXML::saveGUI().

◆ getSliderObject()

const CDataObject * CSlider::getSliderObject ( ) const

Retrieve the slider object.

Returns
const CDataObject * pObject

References mpSliderObject.

◆ getSliderObjectCN()

const std::string & CSlider::getSliderObjectCN ( ) const

Retrieve the slider object CN.

Returns
const std::string & sliderObjectCN

References mCN.

Referenced by CCopasiXML::saveGUI().

◆ getSliderType()

CSlider::Type CSlider::getSliderType ( ) const

Retrieve the slider type.

Returns
const CSlider::Type type

References mSliderType.

Referenced by CCopasiXML::saveGUI().

◆ getSliderValue()

const C_FLOAT64 & CSlider::getSliderValue ( ) const

Retrieve the slider Value.

Returns
const C_FLOAT64 Value

References mValue.

Referenced by resetRange(), CCopasiXML::saveGUI(), setMaxValue(), setMinValue(), and setSliderObject().

◆ getSynced()

bool CSlider::getSynced ( ) const

Returns whether the value is to be kept in sync the the objects value.

Returns
bool isSynced.

References mSync.

◆ getTickFactor()

unsigned C_INT32 CSlider::getTickFactor ( ) const

Retrieve the tick factor.

Returns
const unsigned C_INT32 & tickFactor

References mTickFactor.

Referenced by CCopasiXML::saveGUI().

◆ getTickNumber()

unsigned C_INT32 CSlider::getTickNumber ( ) const

Retrieve the tick number.

Returns
const unsigned C_INT32 & tickNumber

References mTickNumber.

Referenced by CCopasiXML::saveGUI().

◆ isValid()

bool CSlider::isValid ( ) const

Checks whether the object the slider points to actually exists. Returns true if it does.

References CObjectInterface::DataObject(), CDataModel::getModel(), CDataObject::getObjectDataModel(), CDataObject::getObjectFromCN(), and mpSliderObject.

◆ resetRange()

void CSlider::resetRange ( )

Reset the minimum and maximum value to defaults. For the minimum this is half the current value. For the maximum this is twice the current value.

References C_FLOAT64, getSliderValue(), mMaxValue, mMinValue, mSliderType, and Undefined.

◆ resetValue()

void CSlider::resetValue ( )

Sets the value of the slider back to it's original value.

References mOriginalValue, and setSliderValue().

◆ setAssociatedEntityKey()

bool CSlider::setAssociatedEntityKey ( const std::string &  associatedEntityKey)

Set the key of the associated entity

Parameters
conststd::string & associatedEntityKey
Returns
bool success

References CRootContainer::getKeyFactory(), and mAssociatedEntityKey.

Referenced by SliderHandler::processStart().

◆ setMaxValue()

bool CSlider::setMaxValue ( const C_FLOAT64  maxValue)

Set the slider maximum value.

Parameters
constC_FLOAT64 maxValue
Returns
bool success

References getSliderValue(), mMaxValue, mMinValue, mpSliderObject, mSliderType, mValue, Undefined, and writeToObject().

Referenced by SliderHandler::processStart().

◆ setMinValue()

bool CSlider::setMinValue ( const C_FLOAT64  minValue)

Set the slider minimum value.

Parameters
constC_FLOAT64 minValue
Returns
bool success

References getSliderValue(), mMaxValue, mMinValue, mpSliderObject, mSliderType, mValue, Undefined, and writeToObject().

Referenced by SliderHandler::processStart().

◆ setOriginalValue()

bool CSlider::setOriginalValue ( const C_FLOAT64  value)

Set the sliders original value.

Parameters
constC_FLOAT64 Value
constbool & writeToObject (Default: true)
Returns
bool success

References mMaxValue, mMinValue, mOriginalValue, mSliderType, and Undefined.

◆ setScaling()

bool CSlider::setScaling ( CSlider::Scale  scaling)

Set the scaling for the CSlider.

References mScaling.

Referenced by SliderHandler::processStart().

◆ setSliderObject() [1/2]

bool CSlider::setSliderObject ( const CCommonName objectCN)

Set the slider object.

Parameters
constCCommonName & objectCN
Returns
bool success

References mCN.

◆ setSliderObject() [2/2]

◆ setSliderType()

bool CSlider::setSliderType ( const CSlider::Type  type)

Set the slider type.

Parameters
constCSlider::Type type
Returns
bool success

References mSliderType.

Referenced by SliderHandler::processStart(), and setSliderObject().

◆ setSliderValue()

bool CSlider::setSliderValue ( const C_FLOAT64  value,
const bool &  writeToObject = true 
)

Set the slider value.

Parameters
constC_FLOAT64 Value
constbool & writeToObject (Default: true)
Returns
bool success

References mMaxValue, mMinValue, mSliderType, mSync, mValue, Undefined, and writeToObject().

Referenced by SliderHandler::processStart(), and resetValue().

◆ setSynced()

void CSlider::setSynced ( bool  synced)

Sets whether the value is to be kept in sync the the objects value.

References mSync.

◆ setTickFactor()

bool CSlider::setTickFactor ( const unsigned C_INT32  tickFactor)

Set the tick factor.

Parameters
constunsigned C_INT32 & tickFactor
Returns
bool success

References mTickFactor.

Referenced by SliderHandler::processStart().

◆ setTickNumber()

bool CSlider::setTickNumber ( const unsigned C_INT32  tickNumber)

Set the tick number.

Parameters
constunsigned C_INT32 & tickNumber
Returns
bool success

References mTickNumber.

Referenced by SliderHandler::processStart().

◆ sync()

void CSlider::sync ( )

Set the CSliders value to the value of the underlying object.

References C_FLOAT64, C_INT32, Float, CDataObject::getValuePointer(), Integer, mpSliderObject, mSliderType, mValue, UnsignedFloat, and UnsignedInteger.

Referenced by compile(), and setSliderObject().

◆ toData()

CData CSlider::toData ( ) const
virtual

Retrieve the data describing the object

Returns
CData data

Reimplemented from CDataContainer.

References fatalError.

◆ writeToObject()

Member Data Documentation

◆ mAssociatedEntityKey

std::string CSlider::mAssociatedEntityKey
private

The key of the associated entity of the slider's object.

Referenced by getAssociatedEntityKey(), and setAssociatedEntityKey().

◆ mCN

CRegisteredCommonName CSlider::mCN
private

The CN of the object that the slider modifies.

Referenced by compile(), getSliderObjectCN(), and setSliderObject().

◆ mInitialRefreshes

CCore::CUpdateSequence CSlider::mInitialRefreshes
private

The sequnece of methods to update initial values depending on this sliders object.

Referenced by setSliderObject(), and writeToObject().

◆ mKey

std::string CSlider::mKey
private

The key of the slider.

Referenced by getKey(), and ~CSlider().

◆ mMaxValue

C_FLOAT64 CSlider::mMaxValue
private

◆ mMinValue

C_FLOAT64 CSlider::mMinValue
private

◆ mOriginalValue

C_FLOAT64 CSlider::mOriginalValue
private

The original value of the slider-

Referenced by getOriginalValue(), resetValue(), setOriginalValue(), and setSliderObject().

◆ mpSliderObject

CDataObject* CSlider::mpSliderObject
private

The slider object pointing to the slider's object after compile.

Referenced by compile(), getSliderObject(), isValid(), setMaxValue(), setMinValue(), setSliderObject(), sync(), and writeToObject().

◆ mScaling

Scale CSlider::mScaling
private

The scaling of the slider.

Referenced by getScaling(), setScaling(), and setSliderObject().

◆ mSliderType

Type CSlider::mSliderType
private

The value type of the slider's object.

Referenced by getSliderType(), resetRange(), setMaxValue(), setMinValue(), setOriginalValue(), setSliderType(), setSliderValue(), and sync().

◆ mSync

bool CSlider::mSync
private

Wether the CSlider's value is always in sync with its object's value.

Referenced by compile(), getSynced(), setSliderObject(), setSliderValue(), and setSynced().

◆ mTickFactor

unsigned C_INT32 CSlider::mTickFactor
private

The factor between minor and major ticks.

Referenced by getTickFactor(), and setTickFactor().

◆ mTickNumber

unsigned C_INT32 CSlider::mTickNumber
private

The number of ticks the slider is divided into.

Referenced by getTickNumber(), and setTickNumber().

◆ mValue

C_FLOAT64 CSlider::mValue
private

The value of the slider-

Referenced by getSliderValue(), setMaxValue(), setMinValue(), setSliderValue(), sync(), and writeToObject().

◆ ScaleName

const char * CSlider::ScaleName
static
Initial value:
=
{"linear", "logarithmic", "undefined", NULL}

String representation of valid scalings

Referenced by convertScaleToScaleName().

◆ TypeName

const char * CSlider::TypeName
static
Initial value:
=
{"float", "unsignedFloat", "integer", "unsignedInteger", "Undefined", NULL}

String representation of valid quantity units

Referenced by SliderHandler::processStart(), and CCopasiXML::saveGUI().


The documentation for this class was generated from the following files: