Itasca C++ Interface
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Modules Pages
ipiece.h
1 #pragma once
2 // ipiece.h
3 
4 // Interface for Piece
5 
6 #include "dim.h"
7 #include "base/src/farray.h"
8 
9 namespace itascaxd {
10  using namespace itasca;
11  class IContact;
12  class IBody;
13 
15  class IPiece {
16  public:
18  inline static const TType type_ = 0x4c815b8f;
19  // Returns an IThing interface
20  virtual IThing * getIThing()=0;
21  virtual const IThing *getIThing() const=0;
22 
23  // Returns a list of contacts connected to this piece.
24  // If type is specified, restricts to contacts matching that type.
25  // If p2 is specified, restricts to contacts with that piece.
26  // NOTE: We will be able to do "MOVE COPY" semantics here in VS2010.
27  virtual void getContactList(FArray<IContact *> *ret,const TType &type=0,const IPiece *p2=0)=0;
28  virtual void getContactList(FArray<const IContact *> *ret,const TType &type=0,const IPiece *p2=0) const=0;
29 
30  // Return the count of contacts, active and inactive
31  virtual quint64 getContactCount(bool active,const TType &type=0,bool domainToo = false) const = 0;
32 
33  // Returns TRUE if a matching contact exists to this piece.
34  // If type is specified, contact must match that type.
35  // If p2 is specified, contact must be with that piece.
36  virtual bool hasContact(const TType &type=0,const IPiece *p2=0) const=0;
37 
38  // Get a pointer to the body to which this Piece belongs
39  virtual IBody * getIBody()=0;
40  virtual const IBody *getIBody() const=0;
41 
42  // Get a pointer to the IThing used for interactions
43  virtual IThing * getIThingForInteraction()=0;
44  virtual const IThing * getIThingForInteraction() const=0;
45 
46  // Get next IPiece in the LOCAL list of Pieces associated with this Body
47  virtual IPiece * getNextPiece()=0;
48  virtual const IPiece *getNextPiece() const=0;
49 
50  // Piece properties
51  virtual bool setProperty(const QString &name,const QVariant &v)=0;
52  virtual QVariant getProperty(const QString &name) const=0;
53  virtual QStringList getAllProperties() const=0;
54  virtual bool isProperty(const QString &name) const=0;
55 
56  // Piece attributes
57  virtual bool setAttribute(const QString &name,const QVariant &v)=0;
58  virtual QVariant getAttribute(const QString &name) const=0;
59  virtual QStringList getAllAttributes() const=0;
60  virtual bool isAttribute(const QString &name) const=0;
61 
62  // Get the ultimate derived type
63  virtual TType getDerivedType() const=0;
64 
65 
66  };
67 
68 } // namespace itascaxd
69 // EoF
namespace Itasca
Definition: basememory.cpp:9
Base class for items that will be stored in containers.
Definition: ithing.h:31
DIM - Provides code portability between 2D and 3D codes.
An array class that attempts to minimize unnecessary heap access.
Definition: ipiece.h:15
unsigned int TType
class type indicator
Definition: basedef.h:41
Itasca Library standard namespace, specific to 2D or 3D.
Definition: icontactmodule.h:4
An array class that attempts to minimize unnecessary heap access.
Definition: farray.h:27
Definition: ibody.h:20