Aimsun Next Scripting  22
Public Types | Public Member Functions | Static Public Attributes | List of all members
GKObject Class Reference
Inheritance diagram for GKObject:
GKBaseObject DTAIterativeSimulationResultData DetectorLocation GKAuthority GKCentroidConfiguration GKControlJunction GKControlPlan GKControlPlanSignal GKDetectionPattern GKDistributionCentroidType GKDistributionDataSet GKDynamicTrafficSnapshot GKFolder GKFunctionComponent GKFunctionCost GKGenerationAttractionCentroidType GKGenerationAttractionDataSet GKGenerationAttractionDataSetAttribute GKGenerationAttractionVector GKGenericExperiment GKGenericScenario GKGeoObject GKGeometryConfiguration GKGroupingType GKLaneType GKMasterControlPlan GKMobileAgent GKModel GKNetworkAttributesOverride GKPTZonePlan GKParkingCentroidType GKPathAssignment GKPathAssignmentPlan GKPrintLayout GKProblem GKPublicLinePlan GKPublicLineTimeTable GKPublicLineTimeTableSchedule GKRealDataSet GKReplication GKRoadType GKScenarioChange GKScript GKSimulationEvent GKStrategy GKTimePeriod GKTrafficArrivals GKTrafficDemand GKTrafficDemandItem GKTrafficProfile GKTransportationMode GKTrigger GKTripPurpose GKUserClass GKVehicleClass GKViewBookmark GKViewMode GKViewModeStyle

Public Types

enum  IdentifierFormFlag {
  eIdentifierDefault , eIdentifierId , eIdentifierName , eIdentifierExternalId ,
  eIdentifierTypeExternalName , eIdentifierDescription , eIdentifierStandard , eIdentifierStandardWithType ,
  eIdentifierAll
}
 
enum  GKLockType { eNone , eModification , eDelete , eModificationDelete }
 
enum  GKObjectStatus { eNew , eSaved , eModified , eDeleted }
 
typedef QFlags< GKObject::IdentifierFormFlagIdentifierForm
 

Public Member Functions

 GKObject ()
 
 GKObject (const GKObject &o)
 
virtual void addedToCatalog ()
 
virtual void removedFromCatalog ()
 
uint getTick () const
 
virtual void increaseTick ()
 
void setTick (uint t)
 
virtual GKObjectclone (bool addItToModel=true) const
 
virtual GKObjectcloneAsTemporary (bool addItToModel=true) const
 
GKFoldergetCreateRootFolder ()
 
GKFoldergetRootFolder () const
 
void setRootFolder (GKFolder *afolder)
 
GKFolderfindFolder (const QString &byName) const
 
QVector< GKFolder * > getParentFolders () const
 
bool isDataValueNull (const GKColumn *attr) const
 
virtual QVariant * getDataValue (const GKColumn *attr, bool *deleteit, const GKContext &context=GKContext::anyContext) const
 
QVariant * getDataValueByID (uint attrId, bool *deleteit, const GKContext &context=GKContext::anyContext) const
 
virtual void setDataValue (const GKColumn *attr, const QVariant &v)
 
void setDataValueByID (uint attrId, const QVariant &v)
 
virtual void setDataValueObject (const GKColumn *attr, const GKObject *obj)
 
void setDataValueObjectByID (uint attrId, const GKObject *obj)
 
virtual void setDataValueDouble (const GKColumn *attr, double v)
 
void setDataValueDoubleByID (uint attrId, double v)
 
virtual double getDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double *deviation=NULL) const
 
double getDataValueInTSByID (uint attrId, GKTimeSerieIndex index, double *deviation=NULL) const
 
bool hasAnyTSWithData () const
 
virtual GKTimeSeriegetDataValueTS (const GKColumn *attr) const
 
GKTimeSeriegetDataValueTSByID (uint attrId) const
 
virtual void setDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double value, double deviation, GKTSDescription *aDescription=NULL, int reservedSize=0)
 
virtual void setDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double value, double deviation, double lowerValue, GKTSDescription *aDescription=NULL, int reservedSize=0)
 
virtual void setDataValueInSingleTS (const GKColumn *attr, GKTimeSerieIndex index, double value, double deviation, GKTSDescription *aDescription)
 
void setDataValueInTSByID (uint attrId, GKTimeSerieIndex index, double value, double deviation, GKTSDescription *aDescription=NULL, int reservedSize=0)
 
virtual void setAggregatedValueInTS (const GKColumn *attr, double value, double deviation, GKTSDescription *aDescription=NULL)
 
void setAggregatedValueInTSByID (uint attrId, double value, double deviation, GKTSDescription *aDescription=NULL)
 
virtual void clearDataValueTS (const GKColumn *attr, GKTSDescription *aDescription=NULL)
 
void clearDataValueTSByID (uint attrId, GKTSDescription *aDescription=NULL)
 
virtual int getDataValueInt (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
int getDataValueIntByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
virtual double getDataValueDouble (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
double getDataValueDoubleByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QString getDataValueString (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QString getDataValueStringByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
virtual bool getDataValueBool (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
bool getDataValueBoolByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
virtual GKObjectgetDataValueObject (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
GKObjectgetDataValueObjectByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QDate getDataValueDate (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QDate getDataValueDateByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QTime getDataValueTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QTime getDataValueTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
QDateTime getDataValueDateTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
QDateTime getDataValueDateTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
GKTimeDuration getDataValueTimeDuration (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const
 
GKTimeDuration getDataValueTimeDurationByID (uint attrId, const GKContext &context=GKContext::anyContext) const
 
void removeDataValue (const GKColumn *attr)
 
void removeDataValueByID (uint attrId)
 
const QString & getDescription () const
 
void setDescription (const QString &adescription)
 
const QString & getExternalId () const
 
void setExternalId (const QString &anId)
 
virtual GKObjectDelCmd * getDelCmd ()
 
virtual GKObjectConnectionDelCmd * getDelConnectionCmd (GKObject *target)
 
virtual void nonCommandObjectRemoved (GKObject *)
 
virtual void init ()
 
virtual void setId (uint aid, GKModel *model)
 
uint getId () const
 
QUuid getUUID () const
 
virtual void setName (const QString &aname)
 
const QString & getName () const
 
QString getExtendedId (IdentifierForm form=eIdentifierDefault) const
 
QString getNameOrExtendedId (IdentifierForm form=eIdentifierDefault) const
 
virtual const QString & getTypeName () const
 
virtual QString getTypeExternalName () const
 
const GKObjectgetMaster () const
 
GKTypegetType () const
 
virtual void setType (GKType *atype)
 
bool isA (const GKType *atype) const
 
bool isA (const QString &typeName) const
 
virtual void setModel (GKModel *amodel)
 
GKModelgetModel () const
 
virtual void setLock (GKLockType atype)
 
GKLockType getLock () const
 
virtual bool canBeDeleted () const
 
virtual bool canBeModified () const
 
virtual bool canBeEdited () const
 
GKObjectStatus getStatus () const
 
virtual void setStatus (const GKObjectStatus astatus)
 
void notifyStatusChange ()
 
bool isTemporary () const
 
void setTemporary (bool value)
 
bool isExternal () const
 
void setExternal (bool value)
 
virtual void preferencesChanged ()
 
void removeColumn (GKColumn *column)
 
void resetColumn (GKColumn *column)
 
- Public Member Functions inherited from GKBaseObject
 GKBaseObject ()
 
 if (base)
 
virtual uint getId () const =0
 
virtual const QString & getTypeName () const =0
 
virtual QString getTypeExternalName () const =0
 
virtual const GKObjectgetMaster () const =0
 
virtual const QString & getName () const =0
 
virtual const QString & getExternalId () const =0
 
virtual const QString & getDescription () const =0
 
virtual GKModelgetModel () const =0
 
virtual QVariant * getDataValue (const GKColumn *attr, bool *deleteit, const GKContext &context=GKContext::anyContext) const =0
 
virtual QVariant * getDataValueByID (uint attrId, bool *deleteit, const GKContext &context=GKContext::anyContext) const =0
 
virtual double getDataValueInTS (const GKColumn *attr, GKTimeSerieIndex index, double *deviation=NULL) const =0
 
virtual double getDataValueInTSByID (uint attrId, GKTimeSerieIndex index, double *deviation=NULL) const =0
 
virtual GKTimeSeriegetDataValueTS (const GKColumn *attr) const =0
 
virtual GKTimeSeriegetDataValueTSByID (uint attrId) const =0
 
virtual int getDataValueInt (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual int getDataValueIntByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual double getDataValueDouble (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual double getDataValueDoubleByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QString getDataValueString (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QString getDataValueStringByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual bool getDataValueBool (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual bool getDataValueBoolByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKObjectgetDataValueObject (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKObjectgetDataValueObjectByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDate getDataValueDate (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDate getDataValueDateByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QTime getDataValueTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QTime getDataValueTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDateTime getDataValueDateTime (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual QDateTime getDataValueDateTimeByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKTimeDuration getDataValueTimeDuration (const GKColumn *attr, const GKContext &context=GKContext::anyContext) const =0
 
virtual GKTimeDuration getDataValueTimeDurationByID (uint attrId, const GKContext &context=GKContext::anyContext) const =0
 

Static Public Attributes

static uint typeNameAtt
 
static uint typeExternalNameAtt
 
static uint revisedAtt
 
- Static Public Attributes inherited from GKBaseObject
Py_END_ALLOW_THREADS static End uint idAtt
 
static uint nameAtt
 
static uint externalIdAtt
 
static uint descriptionAtt
 

Additional Inherited Members

- Public Attributes inherited from GKBaseObject
ConvertToSubClassCode Py_BEGIN_ALLOW_THREADS GKBaseObjectbase = (GKBaseObject*)sipCpp
 
 sipType = 0
 

Detailed Description

The main class in the GKernel module. It offers:

Object creation

A GKObject is created using the new command available for its GKType or the GKSystem::newObject call, either when a new object is required or when an object is restored from disk or copied (from the clipboard). When an object is created it receives a type and a model and its stored in the catalog (GKCatalog). Never call the new operator to create an object since all these additional initializations will not be done (the exception to the rule is when the developer wants to create a temporary object and type, model or catalog presence are not required).

Object creation example:

GKModel *model;
...
polyline = GKSystem.getSystem().newObject( "GKPolyline", model )
This class contains all the objects in a model.
Definition: GKModel.sip:62
Class that keeps information about all data that is shared by the documents.
Definition: GKSystem.sip:35
GKObject * newObject(const QString &, GKModel *)
static GKSystem & getSystem()
Singleton !

Object Factory

The GKSystem::newObject method looks for a C function that creates the object (an object factory). This function, in order to be located must be called in a specific way and explicitly exported in Windows platform (in the other platforms symbols in a shared library are exported by default).

For example, if we add MyClass to the system, in order to create instances of it we will implement a C function witch name will be MyClass followed by Factory:

extern "C" EXPORT_MACRO GKObject * MyClassFactory( GKModel * model, GKType * type );
Main class, almost all the objects derive from this class.
Definition: GKObject.sip:238
Type information for an object.
Definition: GKType.sip:193

The implementation of MyClassFactory will be:

GKObject * MyClassFactory( GKModel * model, GKType * type )
{
return new MyClass();
}

If the developer does not provide an object factory with the correct name, signature and correctly exported the method GKSystem::newObject will fail and no object will be created.

Exporting Symbols

Classes and functions defined in the developer plug-in and used by Aimsun (object factories, editor factories, new classes,...) resides in a DLL in Windows or a shared library in UNIX, Linux and MAC OS X. In Windows platform (due to Microsoft and Intel C++ compilers) these symbols must be explicitly exported, that is, marked as symbols that can be used by the application where the DLL is loaded. In the other platforms (due to GCC compiler) these symbols are automatically exported.

In order to export symbols they have to be marked with __declspec(dllexport) when the DLL is compiled and must be marked as __declspec(dllimport) when the symbol is included by an application that will use it. Under GCC and CLANG compiler the priciple is the same, but the marks are different.

The best way to deal with this requirement is to define a macro as follow:

#include <qglobal.h>
#if defined (Q_CC_MSVC)
#define EXPORT_SYMBOL __declspec(dllexport)
#define IMPORT_SYMBOL __declspec(dllimport)
#elif defined (Q_CC_GNU) || defined (Q_CC_CLANG)
#define EXPORT_SYMBOL __attribute__ ((visibility("default")))
#define IMPORT_SYMBOL
#endif
#ifdef _DLL_DEF
#define EXPORT_MACRO EXPORT_SYMBOL
#else
#define EXPORT_MACRO IMPORT_SYMBOL
#endif
This macro requires that, during compilation, the developer defines _DLL_DEF when compiling the DLL.
If another DLL or application uses this DLL then it will define _WIN32

but not _DLL_DEF so, in this case, __declspec(dllimport) will be used.

Is recommendable for the name of the macro (EXPORT_MACRO in the example) to be unique among other DLLs. A good name can be, for example, PLUGING_NAMEEXPORT, where PLUGING_NAME is the name of the plug-in.

Identifiers

An object has not only a type and a model but also a unique identifier (set when the object is created the first time via GKSystem::newObject) and inmutable during all the object lifetime. Use the GKSystem::getId to get the identifier.

It supports also an external identifier using the GKObject::externalIdAtt attribute. This attribute is used to identify this object in an external system in where the unique identifier of this object cannot be used (either because the identifier is coded in a different way or because the identifier was already ste and cannot be changed). Use the methods GKObject GKObject::getExternalId and GKObject::setExternalId.

Store and Restore

Objects are stored in a file via the GKObject::store method. The developer must call first the store method from the super class and then add all new information to the data stream. See GKDataStream documentation for further details.

Objects are restored from a file using the GKObject::restore method. The developer must call first the restore method from the super class and, then, read any additional data. Note that versioning is supported. See GKType and GKDataStream for more information.

Generic Attribute Access (Extensible Object Model)

Aimsun can access attributes from any object in a generic way using the GKObject::getDataValue and GKObject::setDataValue methods. These attributes have been declared during the GKType creation.

There is one way to store data in a generic way: using the GKObject::setDataValue method and several ways to gte the data back: GKObject::getDataValue, GKObject::getDataValueInt, GKObject::getDataValueBool, GKObject::getDataValueDouble and GKObject::getDataValueString.

There are two differences between the generic getDataValue and the more specific ones:

So, the specific calls are much more efficient and are always preferred.

As a developer you need to rewrite these functions (the set and the get) only for internal attributes. When doing so be sure that a call to the supertype method is done if the attribute is not in this type (because can be in the super type).

For the get only one function has to be written, either the generic one (GKObject::getDataValue) or the specific one (in function of the attribute type).

An example follows (see also GKType): If we have the following class:

class Road : public GKPolyline
{
int speed;
};
A polyline class.
Definition: GKPolyline.sip:22

Then we will write the set method:

void Road::setDataValue( const GKColumn * attr, const QVariant & v )
{
if( attr == speedAtt ){
speed = v.toInt();
}else{
}
}else{
}
}
An attribute for a type.
Definition: GKColumn.sip:103
@ eInternal
Definition: GKColumn.sip:143
const GKColumnType getStoreType() const
See GKColumn::GKColumnType.
virtual void setDataValue(const GKColumn *attr, const QVariant &v)

and the get method:

int Road::getDataValueInt( const GKColumn * attr, const GKContext & context ) const
{
int res = 0;
if( attr == speedAtt ){
res = speed;
}else{
res = GKPolyline::getDataValueInt( attr, context );
}
}else{
res = GKPolyline::getDataValueInt( attr, context );
}
return res;
}
Context time for time dependent data (As Time Series).
Definition: GKContext.sip:28
virtual int getDataValueInt(const GKColumn *attr, const GKContext &context=GKContext::anyContext) const

or the generic get method:

QVariant * Road::getDataValue( const GKColumn * attr, bool * deleteit )
{
QVariant *res = nullptr;
*deleteit = false;
if( attr == speedAtt ){
res = new QVariant( speed );
*deleteit = true;
}else{
res = GKPolyline::getDataValue( attr, deleteit );
}
}else{
res = GKPolyline::getDataValue( attr, deleteit );
}
return res;
}
virtual QVariant * getDataValue(const GKColumn *attr, bool *deleteit, const GKContext &context=GKContext::anyContext) const

Folders

Each GKObject can have a folder in where it can store any kind of data. This folder is called the root folder. Then, this folder can store a collection of objects and folders (and so on).

Object Status

An object changes its status during its lifetime. It goes from new when created, to saved when stored in disk (or restored from it), to deleted when its deleted and modified when its edited (in a dialog, in a command).

All the status changes are managed automatically by the system expect the modify one. The developer must mark the object has modified when it is modified (usually in the editor during the accept operation and in the command during the undo and redo).

If the object is not marked as modified when is modified then it will not be saved in a database (database store and restore will be supported in future Aimsun versions).

When a operation modifies an object is important to call GKObject::increaseTick so that observers of this object will be aware of a change.

Delete commands

When this object is deleted the system will ask for a delete command using the method GKObject::getDelCmd. This command will have the responsibility for deleting the object and all the references to it (and undo this operation).

See also
GKType, GKColumn, GKModel, GKDataStream, GKFolder, GKPreferences

Member Typedef Documentation

◆ IdentifierForm

Member Enumeration Documentation

◆ GKLockType

Lock types for this object.

Enumerator
eNone 
eModification 
eDelete 
eModificationDelete 

◆ GKObjectStatus

See GKObject::getStatus

Enumerator
eNew 
eSaved 
eModified 
eDeleted 

◆ IdentifierFormFlag

When asking for the extended identifier (GKObject::getExtendedId) of an object, the information to use to create it. It can be a combination of:

  • eIdentifierId: the identifier
  • eIdentifierName: the name
  • eIdentifierExternalId: the external ID
  • eIdentifierDescription: the description
  • eIdentifierTypeExternalName: the externalName of the type
Enumerator
eIdentifierDefault 
eIdentifierId 
eIdentifierName 
eIdentifierExternalId 
eIdentifierTypeExternalName 
eIdentifierDescription 
eIdentifierStandard 
eIdentifierStandardWithType 
eIdentifierAll 

Constructor & Destructor Documentation

◆ GKObject() [1/2]

GKObject::GKObject ( )

◆ GKObject() [2/2]

GKObject::GKObject ( const GKObject o)

Member Function Documentation

◆ addedToCatalog()

virtual void GKObject::addedToCatalog ( )
virtual

Called by the catalog when this object is added to it.

◆ canBeDeleted()

virtual bool GKObject::canBeDeleted ( ) const
virtual

Return true is this object can be deleted. This function can be rewritten to support complex locks as objects locked because its container is locked.

Reimplemented in GKCentroid.

◆ canBeEdited()

virtual bool GKObject::canBeEdited ( ) const
virtual

Return true is this object can be modified. This function can be rewritten to support complex locks as objects locked because its container is locked.

Reimplemented in GKGeoObject, and GKLayer.

◆ canBeModified()

virtual bool GKObject::canBeModified ( ) const
virtual

Return true is this object can be modified. This function can be rewritten to support complex locks as objects locked because its container is locked.

Reimplemented in GKCentroid, GKGeoObject, and GKLayer.

◆ clearDataValueTS()

virtual void GKObject::clearDataValueTS ( const GKColumn attr,
GKTSDescription aDescription = NULL 
)
virtual

Clears a Time Series and initializes it using an optional description

◆ clearDataValueTSByID()

void GKObject::clearDataValueTSByID ( uint  attrId,
GKTSDescription aDescription = NULL 
)

Clears a Time Series and initializes it using an optional description

◆ clone()

virtual GKObject * GKObject::clone ( bool  addItToModel = true) const
virtual

Returns this object copied in a new one.

Reimplemented in GKControlJunction, GKControlPlan, GKMobileAgent, GKRealDataSet, GKTrafficDemand, GKTrafficState, GKVehicle, and GKPedestrianODMatrix.

◆ cloneAsTemporary()

virtual GKObject * GKObject::cloneAsTemporary ( bool  addItToModel = true) const
virtual

Returns this object copied in a new temporary one.

◆ findFolder()

GKFolder * GKObject::findFolder ( const QString &  byName) const

Finds a folder by its internal name among the different folders in this object.

See also
GKFolder::findFolder

◆ getCreateRootFolder()

GKFolder * GKObject::getCreateRootFolder ( )

Returns the root folder. If the root folder doesn't exist it will create one.

◆ getDataValue()

virtual QVariant * GKObject::getDataValue ( const GKColumn attr,
bool *  deleteit,
const GKContext context = GKContext::anyContext 
) const
virtual

Get the value of an attribute. If no value is found, None is returned. If deleteit is true, the returned value must be deleted by the method that makes the call.

Implements GKBaseObject.

◆ getDataValueBool()

virtual bool GKObject::getDataValueBool ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

See GKObject::getDataValueInt

Implements GKBaseObject.

Reimplemented in GKSection.

◆ getDataValueBoolByID()

bool GKObject::getDataValueBoolByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueByID()

QVariant * GKObject::getDataValueByID ( uint  attrId,
bool *  deleteit,
const GKContext context = GKContext::anyContext 
) const
virtual

Get the value of an attribute. If no value is found, None is returned. If deleteit is true, the returned value must be deleted by the method that makes the call.

Implements GKBaseObject.

◆ getDataValueDate()

QDate GKObject::getDataValueDate ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueDateByID()

QDate GKObject::getDataValueDateByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueDateTime()

QDateTime GKObject::getDataValueDateTime ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueDateTimeByID()

QDateTime GKObject::getDataValueDateTimeByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueDouble()

virtual double GKObject::getDataValueDouble ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueDoubleByID()

double GKObject::getDataValueDoubleByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueInt()

virtual int GKObject::getDataValueInt ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

Helper functions (only for access). It's faster than getDataValue since it doesn't creates any intermediate QVariant for internal attributes. Note that for GKTimeSerie it returns the default value, in order to get any other value (position or condition dependant) use getDataValue to take the whole attribute

Implements GKBaseObject.

Reimplemented in GKSection, and GKForceEnrouteAssignment.

◆ getDataValueIntByID()

int GKObject::getDataValueIntByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

Helper functions (only for access). It's faster than getDataValue since it doesn't creates any intermediate QVariant for internal attributes. Note that for GKTimeSerie it returns the default value, in order to get any other value (position or condition dependant) use getDataValue to take the whole attribute

Implements GKBaseObject.

◆ getDataValueInTS()

virtual double GKObject::getDataValueInTS ( const GKColumn attr,
GKTimeSerieIndex  index,
double *  deviation = NULL 
) const
virtual

Get a value for a TimeSerie or 0.0 if no value is found (no value for the index) and, optionally, its deviation.

Implements GKBaseObject.

◆ getDataValueInTSByID()

double GKObject::getDataValueInTSByID ( uint  attrId,
GKTimeSerieIndex  index,
double *  deviation = NULL 
) const
virtual

Get a value for a TimeSerie or 0.0 if no value is found (no value for the index) and, optionally, its deviation.

Implements GKBaseObject.

◆ getDataValueObject()

virtual GKObject * GKObject::getDataValueObject ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueObjectByID()

GKObject * GKObject::getDataValueObjectByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueString()

QString GKObject::getDataValueString ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueStringByID()

QString GKObject::getDataValueStringByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueTime()

QTime GKObject::getDataValueTime ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueTimeByID()

QTime GKObject::getDataValueTimeByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueTimeDuration()

GKTimeDuration GKObject::getDataValueTimeDuration ( const GKColumn attr,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueTimeDurationByID()

GKTimeDuration GKObject::getDataValueTimeDurationByID ( uint  attrId,
const GKContext context = GKContext::anyContext 
) const
virtual

◆ getDataValueTS()

virtual GKTimeSerie * GKObject::getDataValueTS ( const GKColumn attr) const
virtual

Get a Time Series.

Implements GKBaseObject.

◆ getDataValueTSByID()

GKTimeSerie * GKObject::getDataValueTSByID ( uint  attrId) const
virtual

Get a Time Series.

Implements GKBaseObject.

◆ getDelCmd()

virtual GKObjectDelCmd * GKObject::getDelCmd ( )
virtual

Object will be deleted. The user must write a suitable GKObjectDelCmd subclass and return it in this method. The implementation in this class returns a GKObjectDelCmd as it is (it removes the object from the GKModel and delete it if needed after command destruction, removes the object from the GKGeoModel and removes connections to it).

Reimplemented in GKGroupingType, GKSection, GKTrafficState, GKGenerationAttractionDataSetAttribute, and GKTrafficProfile.

◆ getDelConnectionCmd()

virtual GKObjectConnectionDelCmd * GKObject::getDelConnectionCmd ( GKObject target)
virtual

This object has connections to "target" and "target" will be removed. Create and return a delete command to handle undo and redo of the affected connections. If the object is deleted outside a command (no UNDO) then the model will call GKObject::nonCommandObjectRemoved instead.

If this method returns a None it means that the delete is not possible and the command will not be done. If an object is connected to another but decides that no information is needed in the delete command then it has to return an empty GKObjectConnectionDelCmd instead of a None.

See also GKModel.

Reimplemented in GKTrafficState, and GKController.

◆ getDescription()

const QString & GKObject::getDescription ( ) const
virtual

Get the object description (entered by the user)

Implements GKBaseObject.

◆ getExtendedId()

QString GKObject::getExtendedId ( IdentifierForm  form = eIdentifierDefault) const

Returns the informations corresponding to the specified form. If form is eIdentifierDefault, GKObject::defaultIdentifierForm will be used.

◆ getExternalId()

const QString & GKObject::getExternalId ( ) const
virtual

Get the object external ID stored in GKObject::externalIdAtt.

Implements GKBaseObject.

◆ getId()

uint GKObject::getId ( ) const
virtual

Return the unique identifier of this object.

Implements GKBaseObject.

Referenced by GKControlPlan::applyControlJunctions(), and GKControlPlan::applyControlMeterings().

◆ getLock()

GKLockType GKObject::getLock ( ) const

Return the current lock for this object. Note that is preferred to use GKObject::canBeDeleted and GKObject::canBeModified instead of this method since eLock return the lock over this particular object but an object can return eNone (no lock) but can be locked because other (container) object is locked.

◆ getMaster()

const GKObject * GKObject::getMaster ( ) const
virtual

The object that originates this object. In this case it is itself.

Implements GKBaseObject.

◆ getModel()

GKModel * GKObject::getModel ( ) const
virtual

Return the model of this object,

Implements GKBaseObject.

◆ getName()

const QString & GKObject::getName ( ) const
virtual

The optional name of this object.

Implements GKBaseObject.

◆ getNameOrExtendedId()

QString GKObject::getNameOrExtendedId ( IdentifierForm  form = eIdentifierDefault) const

Returns name if not empty or the getExtendedId of the specified form.

◆ getParentFolders()

QVector< GKFolder * > GKObject::getParentFolders ( ) const

It returns the folders that contain this object as a first level object. It will return only the folders that have this object in the list obtained using the function GKFolder::getContents()

◆ getRootFolder()

GKFolder * GKObject::getRootFolder ( ) const

Can return None (no folder) or an empty list (no folders again).

◆ getStatus()

GKObjectStatus GKObject::getStatus ( ) const

Get the current status of this object:

  • eNew: the object has been created during this session.
  • eSaved: the object has been saved.
  • eModified: the object has been modified (edited).
  • eDeleted: the object has been deleted.

◆ getTick()

uint GKObject::getTick ( ) const

The current tick of this object. See GKObject::increaseTick

◆ getType()

GKType * GKObject::getType ( ) const

Returns the type of this object.

◆ getTypeExternalName()

virtual QString GKObject::getTypeExternalName ( ) const
virtual

The type external name of this object. Is equivalent to getType()->getExternalName()

Implements GKBaseObject.

◆ getTypeName()

virtual const QString & GKObject::getTypeName ( ) const
virtual

The type name of this object. Is equivalent to getType()->getName()

Implements GKBaseObject.

◆ getUUID()

QUuid GKObject::getUUID ( ) const

Return the unique identifier of this object.

◆ hasAnyTSWithData()

bool GKObject::hasAnyTSWithData ( ) const

Check if this object has any time series with data

◆ increaseTick()

virtual void GKObject::increaseTick ( )
virtual

Increases the current tick of this object. An object has a tick that represents its age. During every modification the operation increases the tick. Other classes can use this tick information to know if they must sync data that refers to this object (for example a drawer).

◆ init()

virtual void GKObject::init ( )
virtual

Object initialization must be here, this function is called after setting object type, model and the creation of the associate GKRow. Attributes that not depend of the type, or the model can be initialised in the object constructor (since the object is first created and then the type and model are s).

Usually only GKColumn attributes will be initialised here.

Reimplemented in GKTrafficDemand, GKTurningCooperationChange, and GKPedestrianLevelChangeObject.

◆ isA() [1/2]

bool GKObject::isA ( const GKType atype) const

Returns true if this object is an instance of a type (or a sub type of it).

◆ isA() [2/2]

bool GKObject::isA ( const QString &  typeName) const

Returns true if this object is an instance of a type (or a sub type of it).

◆ isDataValueNull()

bool GKObject::isDataValueNull ( const GKColumn attr) const

Returns true if a external column is None, false if it is not external or is no None

◆ isExternal()

bool GKObject::isExternal ( ) const

True if it is a external object, that is an object that lives in another Aimsun document (used by replications and experiments in revisions to show in a network data from another).

An external object is also temporary (see GKObject::isTemporary)

◆ isTemporary()

bool GKObject::isTemporary ( ) const

Return true is it is a temporary object. A temporary object will not be stored with the rest of the GKModel.

◆ nonCommandObjectRemoved()

virtual void GKObject::nonCommandObjectRemoved ( GKObject )
virtual

This object has connections to "target" and "target" will be removed. No command is required as the object is deleted outside a command (if is deleted in a command the model will call GKObject::getDelConnectionCmd instead).

See also GKModel.

Reimplemented in GKController.

◆ notifyStatusChange()

void GKObject::notifyStatusChange ( )

Notify the change on this object. Use setStatus except when the object changes something on it that will not be store, that is, no need to mark the model as unsave but still the GUI (for example) should be notified.

◆ preferencesChanged()

virtual void GKObject::preferencesChanged ( )
virtual

The preferences for the GKModel has been edited. Rewrite this method to react to any change that is interested to this object.

Note that, in order to receive this call, this object must be added to the preferences notification list. And, when the object is destroyed, it must delete it from that list. A good place to set this code is in the GKObject::addedToCatalog and GKObject::removedFromCatalog.

◆ removeColumn()

void GKObject::removeColumn ( GKColumn column)

Removes this (external) column from this object.

◆ removeDataValue()

void GKObject::removeDataValue ( const GKColumn attr)

Removes an external attribute value from this object.

◆ removeDataValueByID()

void GKObject::removeDataValueByID ( uint  attrId)

Removes an external attribute value from this object.

◆ removedFromCatalog()

virtual void GKObject::removedFromCatalog ( )
virtual

Called by the catalog when this object is removed from it.

◆ resetColumn()

void GKObject::resetColumn ( GKColumn column)

Removes the value on the (external) column from this object. A time series or a string will be cleared, a scalar value will be set (if a number) to -1, a bool wil be set to false...

◆ setAggregatedValueInTS()

virtual void GKObject::setAggregatedValueInTS ( const GKColumn attr,
double  value,
double  deviation,
GKTSDescription aDescription = NULL 
)
virtual

Set the aggregated value (and a deviation that can be -1 for NULL deviations) for a time series.

◆ setAggregatedValueInTSByID()

void GKObject::setAggregatedValueInTSByID ( uint  attrId,
double  value,
double  deviation,
GKTSDescription aDescription = NULL 
)

Set the aggregated value (and a deviation that can be -1 for NULL deviations) for a time series.

◆ setDataValue()

virtual void GKObject::setDataValue ( const GKColumn attr,
const QVariant &  v 
)
virtual

Sets the value of an attribute. "v" is copied.

Reimplemented in GKSection, GKForceEnrouteAssignment, and GKPedestrianType.

◆ setDataValueByID()

void GKObject::setDataValueByID ( uint  attrId,
const QVariant &  v 
)

Sets the value of an attribute. "v" is copied.

◆ setDataValueDouble()

virtual void GKObject::setDataValueDouble ( const GKColumn attr,
double  v 
)
virtual

Sets the value of an attribute.

◆ setDataValueDoubleByID()

void GKObject::setDataValueDoubleByID ( uint  attrId,
double  v 
)

Sets the value of an attribute.

◆ setDataValueInSingleTS()

virtual void GKObject::setDataValueInSingleTS ( const GKColumn attr,
GKTimeSerieIndex  index,
double  value,
double  deviation,
GKTSDescription aDescription 
)
virtual

Set the value (and a deviation that can be -1 for NULL deviations) for a time series interval. If the time series has not been created, this method will create it. The time series created will be a GKSingleValueTimeSerie, that is, a time series with a single time interval. In this case, it is recommended to specify its description (GKTSDescription).

The parameter "index" indicates both the position in the TS and the dimension. If the position is less than 0 (-1 is recomended) the value will be added at the end of the TS.

◆ setDataValueInTS() [1/2]

virtual void GKObject::setDataValueInTS ( const GKColumn attr,
GKTimeSerieIndex  index,
double  value,
double  deviation,
double  lowerValue,
GKTSDescription aDescription = NULL,
int  reservedSize = 0 
)
virtual

Set the value (and a deviation, or upperBound value, that can be -1 for NULL deviations and a lowerBound value, that can be -1 for no bounds definition) for a time series index. If the time series has not been created, this method will created it. In this case, it is recommended to specify its description (GKTSDescription).

The parameter "index" indicates the position in the TS. If the pos is less than 0 (-1 is recommended) the value will be added at the end of the TS.

◆ setDataValueInTS() [2/2]

virtual void GKObject::setDataValueInTS ( const GKColumn attr,
GKTimeSerieIndex  index,
double  value,
double  deviation,
GKTSDescription aDescription = NULL,
int  reservedSize = 0 
)
virtual

Set the value (and a deviation that can be -1 for NULL deviations) for a time series interval. If the time series has not been created, this method will create it. The time series created will be a GKMultiValueTimeSerie, that is, a time series with several time intervals. In this case, it is recommended to specify its description (GKTSDescription).

The parameter "index" indicates both the position in the TS and the dimension. If the position is less than 0 (-1 is recommended) the value will be added at the end of the TS.

◆ setDataValueInTSByID()

void GKObject::setDataValueInTSByID ( uint  attrId,
GKTimeSerieIndex  index,
double  value,
double  deviation,
GKTSDescription aDescription = NULL,
int  reservedSize = 0 
)

Set the value (and a deviation that can be -1 for NULL deviations) for a time series index. If the time series has not been created this method will created it. In this case is recommended to specify its description (GKTSDescription).

The parameter "index" indicates the position in the TS. If the pos is less than 0 (-1 is recomended) the
value will be add at the end of the TS.

◆ setDataValueObject()

virtual void GKObject::setDataValueObject ( const GKColumn attr,
const GKObject obj 
)
virtual

Sets the value of an attribute of type _GKObject.

Reimplemented in GKForceEnrouteAssignment.

◆ setDataValueObjectByID()

void GKObject::setDataValueObjectByID ( uint  attrId,
const GKObject obj 
)

Sets the value of an attribute of type _GKObject.

◆ setDescription()

void GKObject::setDescription ( const QString &  adescription)

Set the object description.

◆ setExternal()

void GKObject::setExternal ( bool  value)

True if it is a external object, that is an object that lives in another Aimsun document (used by replications and experiments in revisions to show in a network data from another).

An external object is also temporary (see GKObject::isTemporary)

◆ setExternalId()

void GKObject::setExternalId ( const QString &  anId)

Set the object external ID stored in GKObject::externalIdAtt.

◆ setId()

virtual void GKObject::setId ( uint  aid,
GKModel model 
)
virtual

This setId sets the unique ID of this object. This id CANNOT be changed, it's assigned on creation time and keep constant during all the object life.

This method is called automatically either when the object is created in the GKSystem::newObject or when its restored.

◆ setLock()

virtual void GKObject::setLock ( GKLockType  atype)
virtual

Set the lock of an object:

  • eNone means no lock
  • eModification means that the object cannot be modified
  • eDelete means that the object cannot be deleted
  • eModificationDelete that the object cannot be neither modified nor deleted.

◆ setModel()

virtual void GKObject::setModel ( GKModel amodel)
virtual

Sets the model in where this object resides. Done automatically by GKSystem::newObject.

◆ setName()

virtual void GKObject::setName ( const QString &  aname)
virtual

The optional name of this object.

Reimplemented in GKControlPlan.

◆ setRootFolder()

void GKObject::setRootFolder ( GKFolder afolder)

Sets the root folder for this object (it comes from a restore operation, in order to create the root folder use GKObject::getCreateRootFolder).

◆ setStatus()

virtual void GKObject::setStatus ( const GKObjectStatus  astatus)
virtual

Change the status of an object and the status of the model (to unsave if the object is modified). Note that a eNew object, when modified, keeps its eNew state. Call GKObject::notifyStatusChange to reflect the change in other objects

◆ setTemporary()

void GKObject::setTemporary ( bool  value)

Set this object to temporary (or not). See GKObject::isTemporary.

◆ setTick()

void GKObject::setTick ( uint  t)

Set the current tick of this object. See GKObject::increaseTick

◆ setType()

virtual void GKObject::setType ( GKType atype)
virtual

Sets the type for this object and creates the extension data (additional attributes for this object) for type "atype". Done automatically by GKSystem::newObject.

Member Data Documentation

◆ revisedAtt

uint GKObject::revisedAtt
static

Is it revised?

◆ typeExternalNameAtt

uint GKObject::typeExternalNameAtt
static

Object Type External Name (GKType::getExternalName) as an attribute.

◆ typeNameAtt

uint GKObject::typeNameAtt
static

Object Type Name (GKType::getName) as an attribute.

© Aimsun SLU
Aimsun ®