23 "ossimConnectableObject",
34 theInputListIsFixedFlag(false),
35 theOutputListIsFixedFlag(false)
44 bool inputListIsFixedFlag,
45 bool outputListIsFixedFlag)
48 theInputListIsFixedFlag(inputListIsFixedFlag),
49 theOutputListIsFixedFlag(outputListIsFixedFlag)
149 ConnectableObjectList::iterator current;
156 if(temp->
getId() == id)
170 if(temp->
getId() == id)
202 for(
ossim_uint32 index = 0; index < connectableList->size(); ++index)
204 if( (*connectableList)[index].valid() )
206 if( (*connectableList)[index]->canCastTo( typeId ) )
208 result = (*connectableList)[index].get();
262 ossimConnectableObjectDirectionType directionType,
281 for(
ossim_uint32 index = 0; index < connectableList->size(); ++index)
283 if( (*connectableList)[index].valid() )
285 if( (*connectableList)[index]->canCastTo( className ) )
287 result = (*connectableList)[index].get();
353 for(
ossim_uint32 index = 0; index < connectableList->size(); ++index)
355 if( (*connectableList)[index].valid() )
357 if( (*connectableList)[index]->canCastTo( className ) )
359 result = (*connectableList)[index].get();
384 ossimConnectableObjectDirectionType directionType,
400 for(
ossim_uint32 index = 0; index < connectableList->size(); ++index)
402 if((*connectableList)[index].valid())
404 if((*connectableList)[index]->canCastTo(typeId))
406 return (*connectableList)[index].get();
424 for(
ossim_uint32 index = 0; index < connectableList->size(); ++index)
435 if((*connectableList)[index].valid())
449 for(
ossim_uint32 index = 0; (index < connectableList->size())&&!result; ++index)
451 if((*connectableList)[index].valid())
464 ossimConnectableObjectDirectionType directionType,
481 for(
ossim_uint32 index = 0; index < connectableList->size(); ++index)
483 if((*connectableList)[index].valid())
485 if((*connectableList)[index]->canCastTo(className))
487 return (*connectableList)[index].get();
504 for(
ossim_uint32 index = 0; index < connectableList->size(); ++index)
507 (*connectableList)[index].get());
516 if((*connectableList)[index].valid())
529 for(
ossim_uint32 index = 0; (index < connectableList->size())&&!result; ++index)
531 if((*connectableList)[index].valid())
559 if (NUMBER_OF_OBJECTS)
561 for (
ossim_uint32 idx = NUMBER_OF_OBJECTS; idx > 0; --idx)
573 result = result->findInputObjectOfType(className);
586 for(inputIdx = 0; inputIdx < inputs; ++inputIdx)
591 result = input->findInputObjectOfType(className);
663 ConnectableObjectList::const_iterator current;
692 ConnectableObjectList::const_iterator current;
723 if( (
object==
this) || (
object==0) )
761 bool disconnectOutputFlag,
762 bool createEventFlag)
769 ConnectableObjectList::iterator current;
772 if( (inputIndex > -1)&&
776 result = (*current).
get();
786 if(createEventFlag&&result.
valid())
799 if(disconnectOutputFlag&&result.
valid())
809 bool disconnectOutputFlag,
810 bool createEventFlag)
813 disconnectOutputFlag,
818 bool disconnectOutputFlag,
819 bool createEventFlag)
831 oldInputs.push_back(inputList[i]);
834 if(createEventFlag && oldInputs.size())
846 bool disconnectInputFlag,
854 ConnectableObjectList::iterator current;
856 if( (outputIndex > -1)&&
860 result = (*current).
get();
882 if(disconnectInputFlag&&result.
valid())
891 bool disconnectInputFlag,
892 bool createEventFlag)
898 bool disconnectInputFlag,
899 bool createEventFlag)
911 for(i = 0; i < (
ossim_int32)outputList.size(); ++i)
916 oldOutputs.push_back(outputList[i]);
919 if(createEventFlag && oldOutputs.size())
943 ConnectableObjectList::iterator current;
968 for(
ossim_uint32 index = 0; index < oldInputs.size(); ++index)
970 if(oldInputs[index].valid())
972 oldInputs[index]->disconnectMyOutput(
this,
false);
993 ConnectableObjectList::iterator current;
1018 for(
ossim_uint32 index = 0; index < oldOutputs.size(); ++index)
1020 if(oldOutputs[index].valid())
1022 oldOutputs[index]->disconnectMyInput(
this,
false);
1028 bool makeOutputConnection,
1029 bool createEventFlag)
1031 if(!
object)
return false;
1034 if(index >= 0)
return index;
1056 <<
"\n to input index " << index <<
" in " <<
getClassName() <<
"\n";
1073 if(makeOutputConnection&&
object)
1078 object->connectMyOutputTo(
this,
false, createEventFlag);
1091 bool makeOutputConnection,
1092 bool createEventFlag)
1125 if((index >= 0)&&!inputObject)
return index;
1126 if(!inputObject)
return -1;
1162 if(makeOutputConnection&&inputObject)
1182 bool makeOutputConnection,
1183 bool createEventFlag)
1189 if(inputList.size() == 1)
1191 if(inputList[0].valid())
1193 return (
connectMyInputTo(inputList[0].
get(), makeOutputConnection, createEventFlag) >= 0);
1219 for(i = 0; i < (
ossim_int32)inputList.size(); ++i)
1221 if(inputList[i].valid())
1229 newInputs.push_back(inputList[i]);
1234 newInputs.push_back(0);
1250 bool makeInputConnection,
1251 bool createEventFlag)
1254 if(index >= 0)
return index;
1275 <<
"\n to output index " << index <<
" in " <<
getClassName() <<
"\n";
1291 if(makeInputConnection&&output)
1308 bool makeInputConnection,
1309 bool createEventFlag)
1315 if(outputList.size() == 0)
1320 if((outputList.size() == 1)&&outputList[0].valid())
1322 if(outputList[0].valid())
1324 return (
connectMyOutputTo(outputList[0].
get(), makeInputConnection, createEventFlag) >= 0);
1333 for(i = 0; i < (
ossim_int32)outputList.size(); ++i)
1335 if((
connectMyOutputTo(outputList[i].
get(), makeInputConnection,
false)<0)&&outputList[i].valid())
1337 newOutputs.push_back(outputList[i].
get());
1341 if(createEventFlag&&newOutputs.size())
1390 ConnectableObjectList::iterator currentInput = inputList.begin();
1396 if(oldInputs[i].valid())
1398 tempOld.push_back(oldInputs[i].
get());
1414 for(i = 0; i < tempOld.size(); ++ i)
1416 tempOld[i]->disconnectMyOutput(
this,
false);
1421 if(inputList.size() == 1)
1428 currentInput = inputList.begin();
1431 while(currentInput != inputList.end())
1433 if((*currentInput).valid())
1437 newInputs.push_back((*currentInput).get());
1474 ConnectableObjectList::const_iterator currentOutput = outputList.begin();
1478 if(outputList.size() == 1)
1482 while(currentOutput != outputList.end())
1522 for(i = numberOfInputs;
1559 for(i = numberOfOutputs;
1576 i < numberOfOutputs;
1595 void ossimConnectableObject::findAllObjectsOfType(ConnectableObjectList& result,
1609 for(j = 0; j < (int)tempList.size(); ++j)
1611 ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), tempList[j]);
1612 if(iter == result.end())
1614 result.push_back(tempList[j].
get());
1621 void ossimConnectableObject::findAllObjectsOfType(ConnectableObjectList& result,
1635 for(j = 0; j < (int)tempList.size(); ++j)
1637 ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), tempList[j]);
1638 if(iter == result.end())
1640 result.push_back(tempList[j].
get());
1647 void ossimConnectableObject::findAllInputsOfType(ConnectableObjectList& result,
1649 bool propagateToInputs,
1650 bool recurseChildren)
1658 if(inter&&recurseChildren)
1663 for(j = 0; j < (int)tempList.size(); ++j)
1665 ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), tempList[j]);
1666 if(iter == result.end())
1668 result.push_back(tempList[j].
get());
1676 if(current&&(current->
canCastTo(typeInfo)))
1678 ConnectableObjectList::iterator position = std::find(result.begin(), result.end(), current);
1680 if(position == result.end())
1682 result.push_back(current);
1689 for(j = 0; j < (int)tempList.size(); ++j)
1691 ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), tempList[j]);
1692 if(iter == result.end())
1694 result.push_back(tempList[j]);
1699 if(propagateToInputs&¤t)
1701 current->findAllInputsOfType(result,
1709 void ossimConnectableObject::findAllInputsOfType(ConnectableObjectList& result,
1711 bool propagateToInputs,
1712 bool recurseChildren)
1719 if(inter&&recurseChildren)
1724 for(j = 0; j < (int)tempList.size(); ++j)
1726 ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), tempList[j]);
1727 if(iter == result.end())
1729 result.push_back(tempList[j]);
1736 if(current&&(current->
canCastTo(className)))
1738 ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), current);
1739 if(iter == result.end())
1741 result.push_back(current);
1749 for(j = 0; j < (int)tempList.size(); ++j)
1751 ConnectableObjectList::iterator iter = std::find(result.begin(), result.end(), tempList[j]);
1752 if(iter == result.end())
1754 result.push_back(tempList[j]);
1759 if(propagateToInputs&¤t)
1761 current->findAllInputsOfType(result,
1803 if(!property.
valid())
return;
1804 if(property->
getName() ==
"Description")
1817 if(name ==
"Description")
1822 else if( (name ==
"class_name") ||
1823 (name ==
"Class name") )
1836 propertyNames.push_back(
"class_name");
1837 propertyNames.push_back(
"Description");
1843 const char* lookup = kwl.
find(prefix,
1915 const char* prefix)
const 1994 bool saveThisStateFlag,
1996 const char* prefix)
const 2001 if (NUMBER_OF_INPUTS)
2012 if (saveThisStateFlag)
2031 bool good_fill =
true;
2033 for(
ossim_uint32 i=0; (i<num_inputs) && good_fill; ++i)
2042 good_fill = container.
addChild(
this);
2052 return ((myOutputIndex >= 0) &&
2056 return ((myOutputIndex >= 0) &&
2062 bool result =
false;
2099 bool result =
false;
2137 bool result =
false;
2143 ConnectableObjectList::iterator i =
2148 if ( (*i)->getId() == id )
2185 bool result =
false;
2191 ConnectableObjectList::iterator bottom =
2195 if ( (*bottom)->getId() != id )
2197 ConnectableObjectList::iterator i =
2202 if ( (*i)->getId() == id )
2243 visitor.
visit(
this);
2254 if((*current).get()&&!visitor.
hasVisited((*current).get())) (*current)->accept(visitor);
2265 if((*current).get()&&!visitor.
hasVisited((*current).get())) (*current)->accept(visitor);
2286 if((*current).get()&&!visitor.
hasVisited((*current).get())) (*current)->accept(visitor);
virtual ossimRefPtr< ossimProperty > getProperty(const ossimString &name) const
virtual void setNumberOfInputs(ossim_int32 numberOfInputs)
Will set the number of inputs.
virtual void visit(ossimObject *obj)
const ossimObject * getOwner() const
Fetches the current owner, most likely a container but not limited to one.
virtual ossimRefPtr< ossimConnectableObject > disconnectMyInput(ossim_int32 inputIndex, bool disconnectOutputFlag=true, bool createEventFlag=true)
Will disconnect the object at the given input index and generate a connection event.
virtual ossim_int32 findInputIndex(const ossimConnectableObject *object)
Return a valid index of the input list if the passed in object is found else return -1...
virtual void setDescription(const ossimString &description)
RTTI_DEF3(ossimConnectableObject, "ossimConnectableObject", ossimObject, ossimListenerManager, ossimPropertyInterface)
bool moveInputUp(const ossimId &id)
Moves the input connection matching id up one in the connection list.
virtual void disconnectAllOutputs()
Will disconnect all of the output objects.
ossim_uint32 getNumberOfSubstringKeys(const ossimString ®ularExpression) const
const char * CONNECTABLE_INPUT_LIST_FIXED_KW
virtual ossimConnectableObject * findFirstObjectOfType(const RTTItypeid &typeInfo, bool recurse=true)=0
virtual void disconnect(ossimConnectableObject *object=0)
Will disconnect the object passed in.
virtual bool getInputListIsFixedFlag() const
virtual ossim_uint32 getNumberOfObjects(bool recurse=true) const =0
Represents serializable keyword/value map.
virtual void disconnectMyInputs(ConnectableObjectList &inputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
const char * find(const char *key) const
virtual bool getOutputListIsFixedFlag() const
void setVisitorType(int vType, bool on=true)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
#define OSSIM_EVENT_CONNECTION_DISCONNECT_ID
virtual bool connectOutputList(ConnectableObjectList &outputList)
Will disconnect itself from all outputs and reset to the passed in output list.
virtual void propagateEventToOutputs(ossimEvent &event)
virtual ossimConnectableObject::ConnectableObjectList findAllObjectsOfType(const RTTItypeid &typeInfo, bool recurse=true)=0
static ossimString toString(bool aValue)
Numeric to string methods.
bool moveInputToBottom(const ossimId &id)
Moves the input connection matching id to the bottom of the connection list.
virtual ossimString getClassName() const
virtual ossim_uint32 saveStateOfAllInputs(ossimKeywordlist &kwl, bool saveThisStateFlag=true, ossim_uint32 objectIndex=1, const char *prefix=0) const
Save the state of all inputs to a keyword list.
ossimConnectableObject(ossimObject *owner=0)
Base constructor of this object.
virtual void setReadOnlyFlag(bool flag)
virtual ossim_uint32 getNumberOfOutputs() const
Return the number of output objects.
ossim_int64 getId() const
bool moveInputDown(const ossimId &id)
Moves the input connection matching id down one in the connection list.
virtual void fireEvent(ossimEvent &event)
void turnOffVisitorType(int vType)
static const char * NUMBER_INPUTS_KW
virtual ossim_int32 findOutputIndex(const ossimConnectableObject *object)
Return a valid index of the output list if the passed in object is found else return -1...
ossimConnectableObject * getInput(ossim_uint32 index=0)
returns the object at the specified index.
void add(const char *prefix, const ossimKeywordlist &kwl, bool overwrite=true)
virtual ossim_int32 getMyOutputIndexToConnectTo(ossimConnectableObject *object) const
Should return the first available index to connect to.
const ConnectableObjectList & getInputList() const
std::vector< ossimRefPtr< ossimConnectableObject > > ConnectableObjectList
ossimConnectableObject * getOutput(ossim_uint32 index=0)
returns the object at the specified index.
ossimConnectableObjectDirectionType
virtual void changeOwner(ossimObject *owner)
Permits changing the object's owner.
#define OSSIM_EVENT_CONNECTION_CONNECT_ID
virtual ossim_int32 getMyInputIndexToConnectTo(ossimConnectableObject *object) const
Should return the first available index to connect to.
virtual bool isConnected(ossimConnectableObjectDirectionType direction=CONNECTABLE_DIRECTION_INPUT) const
will check the direction specified to see if all slots are full.
virtual ossimString getDescription() const
const ossimId & getId() const
Will allow us to get this object's id.
bool toBool() const
String to numeric methods.
virtual ~ossimConnectableObject()
unsigned int ossim_uint32
bool moveInputToTop(const ossimId &id)
Moves the input connection matching id to the top of the connection list.
bool hasVisited(ossimObject *obj) const
virtual void getPropertyNames(std::vector< ossimString > &propertyNames) const
ossimString theDescription
virtual void propagateEventToInputs(ossimEvent &event)
virtual ossim_int32 connectMyInputTo(ossimConnectableObject *inputObject, bool makeOutputConnection=true, bool createEventFlag=true)
Will try to connect this objects input to the passed in object.
const char * CONNECTABLE_OUTPUT_LIST_FIXED_KW
ossimConnectableObject * getObject()
ossimConnectableObject * findObjectOfType(ConnectableObjectList *connectableList, ossimVisitor &visitor)
virtual bool connectInputList(ConnectableObjectList &inputList)
Will disconnect itself from all inputs and reset to the passed in input list.
ossimObject * getObject(ossim_uint32 idx=0)
virtual void setProperty(ossimRefPtr< ossimProperty > property)
const ConnectableObjectList & getOutputList() const
virtual bool loadState(const ossimKeywordlist &kwl, const char *prefix=0)
virtual ossim_int32 connectMyOutputTo(ossimConnectableObject *outputObject, bool makeInputConnection=true, bool createEventFlag=true)
Will try to connect this objects output to the passed in object.
long toLong() const
toLong's deprecated, please use the toInts...
ConnectableObjectList theInputObjectList
Holds a list of input objects.
virtual bool addChild(ossimConnectableObject *attachableObject)
static const char * DESCRIPTION_KW
virtual void setProperty(const ossimString &name, const ossimString &value)
virtual ossim_uint32 getNumberOfInputs() const
Returns the number of input objects.
virtual ossimConnectableObject * getConnectableObject(ossim_uint32 index)=0
VisitorType getVisitorType() const
virtual bool canCastTo(ossimObject *obj) const
const char * c_str() const
Returns a pointer to a null-terminated array of characters representing the string's contents...
bool theInputListIsFixedFlag
Indicates whether the theInputObjectList is fixed.
static const char * ID_KW
ConnectableObjectList theOutputObjectList
Holds a list of output objects.
VisitorType
Enumeration type can be a mask and will traverse a graph of connectables based on the values...
bool stopTraversal() const
virtual ossimRefPtr< ossimConnectableObject > disconnectMyOutput(ossim_int32 outputIndex, bool disconnectInputFlag=true, bool createEventFlag=true)
Will disconnect the object at the given output index and generate a connection event.
virtual void accept(ossimVisitor &visitor)
We will add a visitor interface for all connectable objects.
virtual bool canConnectMyInputTo(ossim_int32 myInputIndex, const ossimConnectableObject *object) const =0
required to be overriden by derived classes
void setId(const ossimId &id)
All connectable objects will have id's.
bool theOutputListIsFixedFlag
Indicates whether the theOutputObjectList is fixed.
virtual bool canConnectMyOutputTo(ossim_int32 myOutputIndex, const ossimConnectableObject *object) const
default implementation is to allow anyone to connect to us.
virtual void disconnectAllInputs()
Will disconnect all of the input objects.
virtual bool fillContainer(ossimConnectableContainer &container)
Inserts this object and all of its children and inputs into the container provided.
static const char * NUMBER_OUTPUTS_KW
OSSIMDLLEXPORT std::ostream & ossimNotify(ossimNotifyLevel level=ossimNotifyLevel_WARN)
virtual bool saveState(ossimKeywordlist &kwl, const char *prefix=0) const
static ossimIdManager * instance()
const ossimString & getName() const
virtual void disconnectMyOutputs(ConnectableObjectList &outputList, bool disconnectOutputFlag=true, bool createEventFlag=true)
virtual void setNumberOfOutputs(ossim_int32 numberOfInputs)
Will set the number of outputs.