29 #ifndef __ARCSSHEET_H__
30 #define __ARCSSHEET_H__
32 #include <arcs/arcscontext.h>
33 #include <arcs/arcsconnection.h>
34 #include <arcs/arcsinit.h>
67 ARCSConnection& addConnection(QString src, QString sgn, QString dst, QString slt,
bool q =
false,
bool head=
false);
78 return createInit(preconnects, dst, slt, t, val);
89 return createInit(postconnects, dst, slt, t, val);
100 return createInit(cleanups, dst, slt, t, val);
110 void getConnections(QStringList & sources, QStringList & signls, QStringList & destinations, QStringList & slts);
118 ARCSConnection & getConnection(QString source, QString sgn, QString dst, QString slt);
121 int getConnectionIndex(
ARCSConnection& connection) {
return connections.indexOf(connection);}
122 int getConnectionIndex(QString source, QString sgn, QString dst, QString slt);
124 int getPreconnectIndex(
ARCSInit& init) {
return preconnects.indexOf(init);}
125 int getPostconnectIndex(
ARCSInit& init) {
return postconnects.indexOf(init); }
126 int getCleanupIndex(
ARCSInit& init) {
return cleanups.indexOf(init); }
129 ARCSInit& getPreConnect(QString dst,QString slt, QString t, QString val)
131 return getInit(preconnects,dst,slt,t,val);
134 ARCSInit& getPostConnect(QString dst,QString slt, QString t, QString val)
136 return getInit(postconnects,dst,slt,t,val);
139 ARCSInit& getCleanup(QString dst,QString slt, QString t, QString val)
141 return getInit(cleanups,dst,slt,t,val);
145 void swapConnections(
int x,
int y);
154 void getPreconnects(QStringList & destinations, QStringList & slts, QStringList & types, QStringList & values)
156 getInits(preconnects, destinations, slts, types, values);
165 void getPostconnects(QStringList & destinations, QStringList & slts, QStringList & types, QStringList & values)
167 getInits(postconnects, destinations, slts, types, values);
176 void getCleanups(QStringList & destinations, QStringList & slts, QStringList & types, QStringList & values)
178 getInits(cleanups, destinations, slts, types, values);
182 void activate() { mutex->lock(); preconnect(); connect(); activated =
true; mutex->unlock(); postconnect(); }
184 void deactivate() { mutex->lock(); disconnect(); cleanup(); activated =
false; mutex->unlock();}
186 void removeConnection(
ARCSConnection c) { connections.removeAll(c); }
187 void removePreconnect(
ARCSInit i) { preconnects.removeAll(i); }
188 void removePostconnect(
ARCSInit i) { postconnects.removeAll(i); }
189 void removeCleanup(
ARCSInit i) { cleanups.removeAll(i); }
191 void setContext(
ARCSContext* ctx) { context = ctx; }
206 void resetConnections() { connections.clear(); }
207 void resetPreconnects() { preconnects.clear(); }
208 void resetPostconnects() { postconnects.clear(); }
209 void resetCleanups() { cleanups.clear(); }
210 void resetProperties() { properties.clear(); }
214 void setProperty(QString name,QString value) { properties[name] = value ; }
217 if (properties.contains(name))
218 return properties[name];
223 void removeProperty(QString name) {
224 properties.remove(name);
231 QStringList getComponentList();
233 void removeComponent(QString name);
241 bool isActivated() {
bool r; mutex->lock(); r = activated; mutex->unlock();
return r; }
248 typedef ARCSInit& (
ARCSSheet::*AddInvocationMethod) (QString, QString, QString, QString);
249 typedef void (
ARCSSheet::*GetInvocationsMethod) (QStringList& , QStringList & , QStringList &, QStringList&);
251 bool isEmpty() {
return connections.isEmpty() || preconnects.isEmpty() || postconnects.isEmpty() || cleanups.isEmpty(); }
256 void swapPreconnects(
int x,
int y) { swapInits(preconnects,x,y); }
257 void swapPostconnects(
int x,
int y) { swapInits(postconnects,x,y); }
258 void swapCleanups(
int x,
int y) { swapInits(cleanups,x,y); }
260 void swapInits(QList<ARCSInit> &lst,
int x,
int y);
265 void removeInitWithComponent(QList<ARCSInit> &lst, QString name);
266 void listComponentInit(QList<ARCSInit>& lst, QSet<QString>& set);
267 void batchInit(QList<ARCSInit> & lst);
268 ARCSInit& createInit(QList<ARCSInit> & lst, QString dst, QString slt, QString t, QString val);
269 ARCSInit& getInit(QList<ARCSInit> &lst, QString dst, QString slt, QString t, QString val);
270 void getInits(QList<ARCSInit> &lst, QStringList & destinations,
271 QStringList & slots, QStringList & types, QStringList& values);
274 QList<ARCSConnection> connections;
275 QList<ARCSInit> preconnects;
276 QList<ARCSInit> postconnects;
277 QList<ARCSInit> cleanups;
281 QHash<QString,QString> properties;
287 #endif //__ARCSSHEET_H__
ARCSInit & addCleanup(QString dst, QString slt, QString t, QString val)
Adds a cleanup invocation to the sheet structure.
QString getProperty(QString name)
ARCSInit & addPreconnect(QString dst, QString slt, QString t, QString val)
Adds a pre-connection initialisation to the sheet structure.
Desribes an initialization over a component.
QStringList getPropertyList()
void setProperty(QString name, QString value)
void getCleanups(QStringList &destinations, QStringList &slts, QStringList &types, QStringList &values)
Allows to retrieve cleanup invocations.
void getPostconnects(QStringList &destinations, QStringList &slts, QStringList &types, QStringList &values)
Allows to retrieve postconnection invocations.
This class manages components and constants in a given context.
ARCSInit & addPostconnect(QString dst, QString slt, QString t, QString val)
Adds a post-connection initialisation to the sheet structure.
Maintains connections between objects.
void getPreconnects(QStringList &destinations, QStringList &slts, QStringList &types, QStringList &values)
Allows to retrieve preconnection invocations.