/usr/include/paraview/pqServerManagerModel.h is in paraview-dev 5.0.1+dfsg1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 | /*=========================================================================
Program: ParaView
Module: pqServerManagerModel.h
Copyright (c) 2005-2008 Sandia Corporation, Kitware Inc.
All rights reserved.
ParaView is a free software; you can redistribute it and/or modify it
under the terms of the ParaView license version 1.2.
See License_v1.2.txt for the full ParaView license.
A copy of this license can be obtained by contacting
Kitware Inc.
28 Corporate Drive
Clifton Park, NY 12065
USA
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
========================================================================*/
#ifndef pqServerManagerModel_h
#define pqServerManagerModel_h
#include <QObject>
#include <QList>
#include "pqCoreModule.h"
#include "vtkType.h" // for vtkIdType.
class pqPipelineSource;
class pqProxy;
class pqRepresentation;
class pqServer;
class pqServerManagerModelItem;
class pqServerManagerObserver;
class pqServerResource;
class pqView;
class vtkPVXMLElement;
class vtkSession;
class vtkSMProxy;
class vtkSMProxyLocator;
class vtkSMSession;
//BTX
class pqServerManagerModel;
template <class T> inline QList<T> pqFindItems(
const pqServerManagerModel* const model);
template <class T> inline QList<T> pqFindItems(
const pqServerManagerModel* const model, pqServer* server);
template <class T> inline T pqFindItem(
const pqServerManagerModel* const model, const QString& name);
template <class T> inline T pqFindItem(
const pqServerManagerModel* const model, vtkSMProxy* proxy);
template <class T> inline T pqFindItem(
const pqServerManagerModel* const model, vtkTypeUInt32 id);
template <class T> inline int pqGetNumberOfItems(
const pqServerManagerModel* const model);
template <class T> inline T pqGetItemAtIndex(
const pqServerManagerModel* const model, int index);
//ETX
/// pqServerManagerModel is the model for the Server Manager.
/// All the pipelines in the Server Manager need a GUI representation
/// to obtain additional information about their connections etc.
/// This class collects that. This is merely representation of all the
/// information available in the Server Manager in a more GUI friendly
/// way. Simplicity is the key here.
class PQCORE_EXPORT pqServerManagerModel : public QObject
{
Q_OBJECT
typedef QObject Superclass;
public:
/// Constructor:
/// \c observer :- instance of pqServerManagerObserver observing the server
/// manager.
pqServerManagerModel(pqServerManagerObserver* observer,
QObject* parent=0);
~pqServerManagerModel();
/// Given a session Id, returns the pqServer instance for that session,
/// if any.
pqServer* findServer(vtkIdType cid) const;
/// Given a vtkSession*, returns the pqServer instance for that session, if
/// any.
pqServer* findServer(vtkSession*) const;
pqServer* findServer(vtkSMSession*) const;
/// Given a server resource, locates the pqServer instance for it, if any.
pqServer* findServer(const pqServerResource& resource) const;
/// Book end events for removing a server.
void beginRemoveServer(pqServer *server);
void endRemoveServer();
/// This method to called by any code that's requesting ServerManager to
/// create a new connection (viz. pqObjectBuilder) to set the resource to be
/// used for the newly create pqServer instance. The active resource is
/// automatically cleared one a new pqServer instance is created. Refer to
/// pqObjectBuilder::createServer for details.
void setActiveResource(const pqServerResource& resource);
/// Given a proxy, locates a pqServerManagerModelItem subclass for the given
/// proxy.
template<class T>
T findItem(vtkSMProxy* proxy) const
{
return ::pqFindItem<T>(this, proxy);
}
/// Given the gloabal id for a proxy,
/// locates a pqServerManagerModelItem subclass for the proxy.
template<class T>
T findItem(vtkTypeUInt32 id) const
{
return ::pqFindItem<T>(this, id);
}
/// Returns a list of pqServerManagerModelItem of the given type.
template <class T>
QList<T> findItems() const
{
return ::pqFindItems<T>(this);
}
/// Returns the number of items of the given type.
template <class T>
int getNumberOfItems() const
{
return ::pqGetNumberOfItems<T>(this);
}
/// Returns the item of the given type and the given index.
/// The index is determined by collecting all the items of the given type in a
/// list (findItems()).
template <class T>
T getItemAtIndex(int index) const
{
return ::pqGetItemAtIndex<T>(this, index);
}
/// Same as findItems<T>() except that this returns only those items that are
/// on the indicated server. If server == 0, then all items are returned.
template <class T>
QList<T> findItems(pqServer* server) const
{
return ::pqFindItems<T>(this, server);
}
/// Returns an item with the given name. The type can be pqProxy
/// subclass, since these are the ones that can have a name.
/// Note that since names need not be unique, using this method is not
/// recommended. This is provided for backwards compatibility alone.
template <class T>
T findItem(const QString& name) const
{
return ::pqFindItem<T>(this, name);
}
/// Internal method.
static void findItemsHelper(const pqServerManagerModel * const model,
const QMetaObject &mo, QList<void *> *list, pqServer* server=0);
/// Internal method.
static pqServerManagerModelItem* findItemHelper(const pqServerManagerModel* const model,
const QMetaObject& mo, vtkSMProxy* proxy);
/// Internal method.
static pqServerManagerModelItem* findItemHelper(const pqServerManagerModel* const model,
const QMetaObject& mo, vtkTypeUInt32 id);
/// Internal method.
static pqServerManagerModelItem* findItemHelper(const pqServerManagerModel* const model,
const QMetaObject& mo, const QString& name);
signals:
/// Signals emitted when a new pqServer object is created.
void preServerAdded(pqServer*);
void serverAdded(pqServer*);
/// Signals emitted when a new pqServer object is properly initialized.
/// This happen just before serverAdded() but should not be used by user.
/// serverAdded() should be the signal to bind against unless you need to be
/// notified before the serverAdded() like the plugin loader do.
void serverReady(pqServer*);
/// Signals emitted when a pqServer instance is being destroyed.
void preServerRemoved(pqServer*);
void serverRemoved(pqServer*);
/// Fired when beginRemoveServer is called.
void aboutToRemoveServer(pqServer* server);
/// Fired when endRemoveServer is called.
void finishedRemovingServer();
/// Signals emitted when any pqServerManagerModelItem subclass is created.
void preItemAdded(pqServerManagerModelItem*);
void itemAdded(pqServerManagerModelItem*);
/// Signals emitted when any new pqServerManagerModelItem subclass is
/// being destroyed.
void preItemRemoved(pqServerManagerModelItem*);
void itemRemoved(pqServerManagerModelItem*);
void preProxyAdded(pqProxy*);
void proxyAdded(pqProxy*);
void preProxyRemoved(pqProxy*);
void proxyRemoved(pqProxy*);
/// Signals emitted when a source/filter is created.
void preSourceAdded(pqPipelineSource* source);
void sourceAdded(pqPipelineSource* source);
/// Signals emitted when a source/filter is destroyed.
void preSourceRemoved(pqPipelineSource*);
void sourceRemoved(pqPipelineSource*);
/// Signals emitted when a view is created
void preViewAdded(pqView* view);
void viewAdded(pqView* view);
/// Signals emitted when a view is destroyed.
void preViewRemoved(pqView*);
void viewRemoved(pqView*);
/// Signals emitted when a representation is created.
void preRepresentationAdded(pqRepresentation* rep);
void representationAdded(pqRepresentation* rep);
/// Signals emitted when a representation is destroyed.
void preRepresentationRemoved(pqRepresentation*);
void representationRemoved(pqRepresentation*);
/// Fired when the name of an item changes.
void nameChanged(pqServerManagerModelItem *item);
/// Fired when the state of the model item changes
void modifiedStateChanged(pqServerManagerModelItem *item);
/// Fired when a connection between two pqPipelineSources is created.
void connectionAdded(pqPipelineSource* source,
pqPipelineSource* consumer, int srcOutputPort);
void preConnectionAdded(pqPipelineSource* source,
pqPipelineSource* consumer, int srcOutputPort);
/// Fired when a connection between tow pqPipelineSources is broken.
void connectionRemoved(pqPipelineSource* source,
pqPipelineSource* consumer, int srcOutputPort);
void preConnectionRemoved(pqPipelineSource* source,
pqPipelineSource* consumer, int srcOutputPort);
/// Fired when a source indicates that data was updated i.e. the pipeline was
/// updated.
void dataUpdated(pqPipelineSource*);
protected slots:
/// Called when a proxy is registered.
virtual void onProxyRegistered(const QString& group, const QString& name,
vtkSMProxy* proxy);
/// Called when a proxy is unregistered.
virtual void onProxyUnRegistered(const QString& group, const QString& name,
vtkSMProxy* proxy);
/// Called when a new server connection is created.
virtual void onConnectionCreated(vtkIdType id);
/// Called when a server connection is closed.
virtual void onConnectionClosed(vtkIdType id);
/// Called when state file is loaded. We need to discover "helper proxies" and
/// set up the associations accordingly.
virtual void onStateLoaded(vtkPVXMLElement*, vtkSMProxyLocator*);
private:
pqServerManagerModel(const pqServerManagerModel&); // Not implemented.
void operator=(const pqServerManagerModel&); // Not implemented.
class pqInternal;
pqInternal* Internal;
};
//-----------------------------------------------------------------------------
template <class T>
inline QList<T> pqFindItems(const pqServerManagerModel* const model)
{
QList<T> list;
pqServerManagerModel::findItemsHelper(model, ((T)0)->staticMetaObject,
reinterpret_cast<QList<void *>*>(&list), 0);
return list;
}
//-----------------------------------------------------------------------------
template <class T>
inline QList<T> pqFindItems(const pqServerManagerModel* const model,
pqServer* server)
{
QList<T> list;
pqServerManagerModel::findItemsHelper(model, ((T)0)->staticMetaObject,
reinterpret_cast<QList<void *>*>(&list), server);
return list;
}
//-----------------------------------------------------------------------------
template <class T>
inline T pqFindItem(const pqServerManagerModel* const model, vtkSMProxy* proxy)
{
return qobject_cast<T>(
pqServerManagerModel::findItemHelper(model, ((T)0)->staticMetaObject, proxy));
}
//-----------------------------------------------------------------------------
template <class T>
inline T pqFindItem(const pqServerManagerModel* const model,
vtkTypeUInt32 id)
{
return qobject_cast<T>(
pqServerManagerModel::findItemHelper(model, ((T)0)->staticMetaObject, id));
}
//-----------------------------------------------------------------------------
template <class T>
inline T pqFindItem(const pqServerManagerModel* const model,
const QString& name)
{
return qobject_cast<T>(
pqServerManagerModel::findItemHelper(model, ((T)0)->staticMetaObject, name));
}
//-----------------------------------------------------------------------------
template <class T>
inline int pqGetNumberOfItems(const pqServerManagerModel* const model)
{
return pqFindItems<T>(model).size();
}
//-----------------------------------------------------------------------------
template <class T>
inline T pqGetItemAtIndex(const pqServerManagerModel* const model, int index)
{
QList<T> items = pqFindItems<T>(model);
if (index < items.size())
{
return items[index];
}
return 0;
}
#endif
|