Aimsun Next Scripting  22
Public Member Functions | Public Attributes | List of all members
GKFolder Class Reference
Inheritance diagram for GKFolder:
GKObject GKBaseObject

Public Member Functions

 GKFolder ()
 
void setInternalName (const QString &)
 
const QString & getInternalName () const
 
GKFolderfindFolder (const QString &) const
 
void setRoot (GKObject *)
 
GKObjectgetRoot () const
 
GKObjectgetAbsoluteRoot () const
 
const GKFolderContents & getContents () const
 
void append (GKObject *)
 
void remove (GKObject *)
 
QVector< GKType * > getContentsTypes (bool staticOn=true, bool mesoOn=true, bool microOn=true, bool travelDemand=true) const
 
bool contains (const GKObject *) const
 
int __contains__ (GKObject *) const
 
End GKFoldercreateFolder (const QString &aname, const QString &ainternalName, bool showOnlyConts=false)
 
void clear ()
 
void deepClear ()
 
bool canBeRenamed () const
 
void setCanBeRenamed (bool)
 
bool showOnlyContents () const
 
void setShowOnlyContents (bool)
 
int __len__ ()
 
End GKObjectoperator[] (int)
 
 if ((a0=sipConvertFromSequenceIndex(a0, len))< 0)
 
 for (GKFolderContents::const_iterator iter=sipCpp->getContents().begin();iter !=sipCpp->getContents().end();iter++, pos++)
 
- Public Member Functions inherited from GKObject
 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
 

Public Attributes

MethodCode sipRes = sipCpp -> contains( a0 )
 
MethodCode int len
 
 len = sipCpp -> getContents().size()
 
 else
 
- Public Attributes inherited from GKBaseObject
ConvertToSubClassCode Py_BEGIN_ALLOW_THREADS GKBaseObjectbase = (GKBaseObject*)sipCpp
 
 sipType = 0
 

Additional Inherited Members

- Public Types inherited from GKObject
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
 
- Static Public Attributes inherited from GKObject
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
 

Detailed Description

GKFolder is a list of objects (GKObject) or folders (GKFolder) contained in an object (GKObject). Every GKObject can contain a folder, called the root folder. This root folder can contain objects and folders (that can contain objects and folder, and so on).

Folders must be registered in the system before using it. See GKSystem::registerFolder

Object folders allow the developer to include information to an object without modifying it. They are similar to the GKColumn and GKType mechanism (called Extensible Object Model) but unrelated (the GKObject::getDataValue and GKObject::setDataValue operations cannot be applied to these folders).

The main advantage is that the GUI class GListViewForModel can list in a browser the content of the GKModel folders and that these contents can be modified at run time. This allows us the addition of non-graphical object to the model (in one of GKModel's folder) that will be graphically represented (as items in the GListViewForModel widget). This representation will allow the user the selection and manipulation of these objects (double click to open its editor or using the context menu to issue commands).

A GKFolder has a name (GKFolder::getName) and an internal name (GKFolder::getInternalName). The internal name identifies the folder uniquely among all the other folders in the system. It's up to the developer to give a unique name to the folder.

Each folder has a root (the object owner of the folder) if it is not a subfolder. If it is a subfolder then the root is a folder and the final object owner can be read using the getAbsoluteRoot method.

In order to create a folder in an object that is not a folder, use the following code:

folder = GKSystem.getSystem().createFolder( object.getCreateRootFolder(), "Internal Name" )
GKFolder * getCreateRootFolder()
Returns the root folder. If the root folder doesn't exist it will create one.
Class that keeps information about all data that is shared by the documents.
Definition: GKSystem.sip:35
static GKSystem & getSystem()
Singleton !
GKFolder * createFolder(GKFolder *root, const QString &folderInternalName, bool showOnlyConts=false)

The method GKObject::getCreateRootFolder returns the root folder for the object. Since a root folder is optional, maybe the root folder has not been created yet, so instead of using the GKObject::getRootFolder method that can return None, we use the GKObject::getCreateRootFolder method that will create the root folder if needed.

And in order to create a folder in a folder, use the following code:

subfolder = GKSystem.getSystem().createFolder( folder, "Internal Name" )

Where, in both examples:

Note that GKFolder derivates from GKObject. A folder contains a list of GKObject and some of these will be GKFolder ; in order to determinate if they are folder or non folders, use the following code:

GKFolderContents::const_iterator iter;
for( iter = folder->getContents().begin(); iter != folder->getContents().end(); iter++ ){
if( dynamic_cast<GKFolder*>( obj ) ){
// It's a folder
...
}else{
// It isn't a folder
...
}
}
An unsorted list of objects and folders.
Definition: GKFolder.sip:93

The developer must create the folder before inserting any object. The folder to be created depends of the object to be inserted. Check the class documentation for the folder external and internal name.

For example, to add a new centroid configuration, in Python:

folder = model.findFolder( "GKModel::centroidsConf" )
if folder == None:
folder = GKSystem.getSystem().createFolder( model.getCreateRootFolder(), "GKModel::centroidsConf" )

Constructor & Destructor Documentation

◆ GKFolder()

GKFolder::GKFolder ( )

Member Function Documentation

◆ __contains__()

int GKFolder::__contains__ ( GKObject ) const

◆ __len__()

int GKFolder::__len__ ( )

◆ append()

void GKFolder::append ( GKObject )

Adds an object to this folder

◆ canBeRenamed()

bool GKFolder::canBeRenamed ( ) const

Returns true if the name of this folder can be renamed (true by default)

◆ clear()

void GKFolder::clear ( )

Clears the folder (objects inside the folder are not deleted just removed from the folder).

◆ contains()

bool GKFolder::contains ( const GKObject ) const

Returns true if obj is in this folder.

◆ createFolder()

End GKFolder * GKFolder::createFolder ( const QString &  aname,
const QString &  ainternalName,
bool  showOnlyConts = false 
)

Creates a subfolder. First it checks if the folder is already here (using the internalName) and if so a pointer to the already existing folder is returned, if not a new one is created.

◆ deepClear()

void GKFolder::deepClear ( )

Clears the folder and deletes all the objects inside.

◆ findFolder()

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

Finds a subfolder of this folder by its internal name.

◆ for()

GKFolder::for ( GKFolderContents::const_iterator  iter = sipCpp->getContents().begin(); iter != sipCpp->getContents().end(); iter++,
pos++   
)
inline

References sipRes.

◆ getAbsoluteRoot()

GKObject * GKFolder::getAbsoluteRoot ( ) const

Returns the first non folder object that is a root: if the root is not a folder it will return the root. If the root is a folder it will return the getAbsoluteRoot of this folder.

◆ getContents()

const GKFolderContents & GKFolder::getContents ( ) const

Gets the content of the folder: a list with objects and folders.

◆ getContentsTypes()

QVector< GKType * > GKFolder::getContentsTypes ( bool  staticOn = true,
bool  mesoOn = true,
bool  microOn = true,
bool  travelDemand = true 
) const

Returns the type of objects that this folder can contain. Since this information is optional a None can be returned.

◆ getInternalName()

const QString & GKFolder::getInternalName ( ) const

Gets the internal folder name.

◆ getRoot()

GKObject * GKFolder::getRoot ( ) const

Gets the root of this folder: a folder if it is a subfolder or an object it is a root folder.

◆ if()

GKFolder::if ( )
inline

◆ operator[]()

End GKObject * GKFolder::operator[] ( int  )

◆ remove()

void GKFolder::remove ( GKObject )

Removes an object from this folder

◆ setCanBeRenamed()

void GKFolder::setCanBeRenamed ( bool  )

Set the _canBeRenamed property for this folder.

◆ setInternalName()

void GKFolder::setInternalName ( const QString &  )

Sets the internal (and unique) folder name.

◆ setRoot()

void GKFolder::setRoot ( GKObject )

Sets the root of this folder. It is done automatically by GKFolder::createFolder.

◆ setShowOnlyContents()

void GKFolder::setShowOnlyContents ( bool  )

Set the _showOnlyContents property for this folder.

◆ showOnlyContents()

bool GKFolder::showOnlyContents ( ) const

If true, when listing this folder in the GListViewForModel widget only its contents will appear and not the list itself and the contents as children of the folder. False by default.

Member Data Documentation

◆ else

GKFolder::else
Initial value:
{
int pos = 0

◆ len [1/2]

MethodCode int GKFolder::len

◆ len [2/2]

GKFolder::len = sipCpp -> getContents().size()

◆ sipRes

MethodCode GKFolder::sipRes = sipCpp -> contains( a0 )

Referenced by for().

© Aimsun SLU
Aimsun ®