a2dPinClass Class Reference

This is a class/type description for a2dPin's. More...

#include <canprim.h>

Collaboration diagram for a2dPinClass:

Collaboration graph
[legend]

List of all members.

Public Types

enum  a2dPinClassFlags { PC_input = 0x0001, PC_output = 0x0002, PC_angle = 0x0004, PC_ALLSET = 0xFFFFFFFF }

Public Member Functions

 a2dPinClass (const wxString &name, wxUint32 flags=PC_input|PC_output)
 constructor
 ~a2dPinClass ()
 destructor
void AddConnect (a2dPinClass *pinClass)
 add a connection pinclass, to which this pin can connect
void RemoveConnect (a2dPinClass *pinClass)
 remove a connection pinclass
const wxString & GetName () const
bool IsInputPin () const
 return true if the pinClass is for pins that accepts input
bool IsOutputPin () const
 return true if the pinClass is for pins that accepts input
bool HasAngleLine () const
 is there an angle line on the pin
void SetAngleLine (bool value)
 is there an angle line on the pin
wxUint32 GetFlags ()
 get all flags
a2dPinClassCanConnectTo (a2dPinClass *other=NULL, wxUint32 flags=PC_input|PC_output) const
 searches in the connection list for a given pin class
std::list< a2dPinClass * > & GetConnectList ()
 return list of connectable pin class objects.
a2dPinClassCanConnectToAsWire (a2dPinClass *specific=NULL, wxUint32 flags=PC_input|PC_output) const
 search in m_canConnectTo list for a pin class which can be used for creating connect objects/wires.
a2dPinClassCanConnectToAsObject (a2dPinClass *specific=NULL, wxUint32 flags=PC_input|PC_output) const
 search in m_canConnectTo list for a pin class which can connect to another object which is NOT connect
void SetConnectObject (a2dCanvasObject *tmplObject)
 the template object is used as a template for creating new wires between pins.
a2dCanvasObjectGetConnectObject () const
 return connect object.
void SetPin (a2dPin *newpin)
 set default pin for graph like structure
a2dPinGetPin ()
 get default pin for graph like structure
void SetPinCanConnect (a2dPin *newpin)
a2dPinGetPinCanConnect ()
 represents the pin styles for pins that can connect right now
void SetPinCannotConnect (a2dPin *newpin)
a2dPinGetPinCannotConnect ()
 represents the pin styles for pins that cannot connect right now
void SetConnectionGenerator (a2dConnectionGenerator *connectionGenerator)
 Set class for generating new connection objects between object and pins.
a2dConnectionGeneratorGetConnectionGenerator () const
 Get class for generating new connection objects between object and pins.
a2dPinClassGetPinClassForTask (a2dConnectTask task, a2dCanvasObject *obj) const

Static Public Member Functions

static void InitializeStockPinClasses ()
 called to initialize static stockobjects
static void DeleteStockPinClasses ()
 called to delete all pin class objects
static a2dPinClassGetClassByName (const wxString &name)
 return the name of this pinclass.

Static Public Attributes

static std::list< a2dPinClass * > m_allPinClasses
 a linked lists of all a2dPinClass'es, so that one can get a class by name
static a2dPinClassAny = NULL
 used to ask for a new default pin on an object.
static a2dPinClassStandard = NULL
 Pins of this class can only connect to pins of the same class.
static a2dPinClassObject = NULL
 Pins of this class can only connect to Wire pins.
static a2dPinClassWire = NULL
 Pins of this class can only connect to Object pins.
static a2dPinClassInput = NULL
 Pins of this class can only connect to Output pins.
static a2dPinClassOutput = NULL
 Pins of this class can only connect to Input pins.
static a2dPinClassObjectInput = NULL
 Pins of this class can only connect to WireInput pins.
static a2dPinClassObjectOutput = NULL
 Pins of this class can only connect to WireOutput pins.
static a2dPinClassWireInput = NULL
 Pins of this class can only connect to ObjectInput pins.
static a2dPinClassWireOutput = NULL
 Pins of this class can only connect to ObjectOutput pins.

Protected Attributes

wxString m_name
 name of pin class
std::list< a2dPinClass * > m_canConnectTo
wxUint32 m_flags
 pinclass specific flags
a2dCanvasObjectPtr m_tmplObject
 Template for created object which represents a connection. e.g a2dWirePolylineL.
a2dPinPtr m_defPin
a2dPinPtr m_defCanConnectPin
a2dPinPtr m_defCannotConnectPin
a2dConnectionGeneratorPtr m_connectionGenerator
 Use this connection generator for wires and pins.


Detailed Description

This is a class/type description for a2dPin's.

a2dPin's have a pin class which can be used by a2dConnectionGenerator to define to which other pin classes ( of other pins ) it can connect and how. E.g. One class might be input and one class might be output and it is only possible to connect an input to an output, but not two inputs or two outputs. This class mainly has a name and an array of pin classes it is allowed to connect to. How and when a pinclass is connected to another pinclass ( one to one, or with a wire and what type of wire ), is decided by the a2dConnectionGenerator.

As an example: You want pin object on certain layers to only connect to pins on some other layers. For that you give a pin on a layerA a a2dPinClass called PC_layerA. And for pins on layers B C D you do the same. Now to be able to connect a PC_layerA to PC_layerB PC_layerC and NOT PC_layerD. You add to PC_layerA its m_canConnectTo, the pin classes: PC_layerA, PC_layerB, PC_layerC. And to PC_layerB, PC_layerC you add at least PC_layerA. You could also define a pin class called PC_layersABC with in its m_canConnectTo he same PC_layersABC, next you use for pins one layers A,B,C this class. So all pins on those ayesr can connect with each other. As you see what layer a pin is on, is of no importance, it is the pin class which allows pins to connect or not.

Both the class and the m_canConnectTo array are created statically. If not, it is your responsibility to remove the canConnectTo array. The m_canConnectTo array is terminated with a zero pointer. The default class is a2dPinClass::Standard, which can only connect to itself.

Definition at line 582 of file canprim.h.


Member Enumeration Documentation

Enumerator:
PC_input  input
PC_output  output
PC_angle  output
PC_ALLSET  For Xor ing and all set

Definition at line 586 of file canprim.h.


Constructor & Destructor Documentation

a2dPinClass::a2dPinClass ( const wxString &  name,
wxUint32  flags = PC_input | PC_output 
)

constructor

Parameters:
name name of the pinclass, can be used e.g. for XML saving
flags type of pin (in/out etc.)

Definition at line 477 of file canprim.cpp.


Member Function Documentation

a2dPinClass * a2dPinClass::CanConnectTo ( a2dPinClass other = NULL,
wxUint32  flags = PC_input | PC_output 
) const

searches in the connection list for a given pin class

If the given pin class is found, this means that the pin having that pinclass can connect to the pin having this pinclass.

Parameters:
other pin to test connection
flags type of pin needed

Definition at line 584 of file canprim.cpp.

a2dPinClass * a2dPinClass::CanConnectToAsWire ( a2dPinClass specific = NULL,
wxUint32  flags = PC_input | PC_output 
) const

search in m_canConnectTo list for a pin class which can be used for creating connect objects/wires.

If in the list a pin class has m_isObjectPin set false and m_tmplObject is set, that one is returned.

Parameters:
specific if set, only look for this type of pin class.
flags type of pin
Returns:
pinclass found or NULL

Definition at line 598 of file canprim.cpp.

a2dPinClass * a2dPinClass::CanConnectToAsObject ( a2dPinClass specific = NULL,
wxUint32  flags = PC_input | PC_output 
) const

search in m_canConnectTo list for a pin class which can connect to another object which is NOT connect

If in the list a pin class has m_isObjectPin set true is returned.

Parameters:
specific if set, only look for this type of pin class.
flags type of pin
Returns:
pinclass found or NULL

Definition at line 614 of file canprim.cpp.

void a2dPinClass::SetConnectObject ( a2dCanvasObject tmplObject  ) 

the template object is used as a template for creating new wires between pins.

You can use it for other purposes as well if needed.

When m_isObjectPin is false (meaning pin class for wire connections), this is a template for a new wire.

Definition at line 630 of file canprim.cpp.

void a2dPinClass::SetPinCanConnect ( a2dPin newpin  ) 

See also:
GetPinCanConnect()

Definition at line 684 of file canprim.cpp.

a2dPin * a2dPinClass::GetPinCanConnect (  ) 

represents the pin styles for pins that can connect right now

This pin is usually bigger than the default pin and green

Definition at line 689 of file canprim.cpp.

void a2dPinClass::SetPinCannotConnect ( a2dPin newpin  ) 

See also:
GetPinCannotConnect()

Definition at line 668 of file canprim.cpp.

a2dPin * a2dPinClass::GetPinCannotConnect (  ) 

represents the pin styles for pins that cannot connect right now

This pin is usually smaller than the default pin and red

Definition at line 673 of file canprim.cpp.


Member Data Documentation

std::list< a2dPinClass* > a2dPinClass::m_canConnectTo [protected]

list of a2dPinClass objects, to which this a2dPinClass object can connect. Each Pin has a a2dPinClass which defines to which that pin can connect to other pins. This is approved based on those other Pins having a a2dPinClass in this array here. Of course another pin which wants to connect, should check the availibility of this pin its pinclass in its own connection list.

Definition at line 726 of file canprim.h.

a2dPinClass * a2dPinClass::Any = NULL [static]

used to ask for a new default pin on an object.

m_connectionGenerator decides what is returned when asking a connection task given this pin class.

Definition at line 752 of file canprim.h.


The documentation for this class was generated from the following files:
a2dPinClass Class Reference -- Tue Aug 31 18:31:55 2010 -- 31 Aug 2010 -- 1.5.5 -- wxArt2D -- . -- Main Page Reference Documentation