/usr/include/ossim/base/ossimConnectableObject.h is in libossim-dev 2.2.2-1.
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 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 | //*******************************************************************
// Copyright (C) 2000 ImageLinks Inc.
//
// License: See top level LICENSE.txt file.
//
// Author: Garrett Potts
//
// Description:
//
// Contains class declaration for ossimConnectableObject the base class for
// all connectable objects.
//
//*************************************************************************
// $Id$
#ifndef ossimConnectableObject_HEADER
#define ossimConnectableObject_HEADER 1
#include <ossim/base/ossimConstants.h>
#include <ossim/base/ossimObject.h>
#include <ossim/base/ossimId.h>
#include <ossim/base/ossimListenerManager.h>
#include <ossim/base/ossimPropertyInterface.h>
#include <ossim/base/ossimRefPtr.h>
#include <vector>
class ossimVisitor;
class ossimConnectableContainer;
class OSSIMDLLEXPORT ossimConnectableObject : public ossimObject,
public ossimListenerManager,
public ossimPropertyInterface
{
public:
typedef std::vector<ossimRefPtr<ossimConnectableObject> > ConnectableObjectList;
enum ossimConnectableObjectDirectionType
{
CONNECTABLE_DIRECTION_NONE = 0,
CONNECTABLE_DIRECTION_INPUT = 1,
CONNECTABLE_DIRECTION_OUTPUT = 2
};
/**
* Base constructor of this object.
*/
ossimConnectableObject(ossimObject* owner=0);
ossimConnectableObject(ossimObject* owner,
ossim_int32 inputListSize,
ossim_int32 outputListSize,
bool inputListIsFixedFlag=true,
bool outputListIsFixedFlag=true);
virtual ~ossimConnectableObject();
/**
* All connectable objects will have id's. This allows us to
* set the id of this object.
*/
void setId(const ossimId& id);
/**
* Will allow us to get this object's id.
*/
const ossimId& getId()const;
/**
* Fetches the current owner, most likely a container but not limited to one.
*/
const ossimObject* getOwner() const;
/**
* Permits changing the object's owner.
*/
virtual void changeOwner(ossimObject* owner);
virtual void setDescription(const ossimString& description);
virtual ossimString getDescription()const;
/**
* will check the direction specified to see if all slots are full.
* If any slot is null then false is returned.
* If a filter requires options testing they
* need to override this method. The argument can be ored together. If you
* want both checked then pass
* CONNECTABLE_DIRECTION_INPUT | CONNECTABLE_DIRECTION_OUTPUT
*/
virtual bool isConnected(
ossimConnectableObjectDirectionType direction = CONNECTABLE_DIRECTION_INPUT)const;
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not achieve exactly
* what you want then you can derive new rules by overriding the virtual
* visit method in ossimVisitor
*
* <pre>
* ossimIdVisitor visitor(id, false, ossimVisitor::VISIT_CHILDREN |
* ossimVisitor::VISIT_INPUTS);
* connectableObject->accept(visitor);
* ossimRefPtr<ossimConnectableObject> object = visitor.getObject();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findConnectableObject(
const ossimId& id));
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not achieve exactly
* what you want then you can derive new rules by overriding the virtual
* visit method in ossimVisitor
*
* <pre>
* ossimTypeIdVisitor visitor(typeId, true, ossimVisitor::VISIT_CHILDREN |
* ossimVisitor::VISIT_INPUTS);
* connectableObject->accept(visitor);
* ossimRefPtr<ossimConnectableObject> object = visitor.getObject();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findObjectOfType(
RTTItypeid typeId,
ossimConnectableObjectDirectionType directionType,
bool recurse = true));
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding
* the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeNameVisitor visitor(typeName, true,
* ossimVisitor::VISIT_CHILDREN | ossimVisitor::VISIT_INPUTS);
* connectableObject->accept(visitor);
* ossimRefPtr<ossimConnectableObject> object = visitor.getObject();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findObjectOfType(
const ossimString& obj,
ossimConnectableObjectDirectionType directionType,
bool recurse = true));
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding
* the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeNameVisitor visitor(typeName, true,
* ossimVisitor::VISIT_CHILDREN | ossimVisitor::VISIT_INPUTS);
* connectableObject->accept(visitor);
* ossimRefPtr<ossimConnectableObject> object = visitor.getObject();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual ossimConnectableObject* findInputObjectOfType(
const ossimString& className));
/**
* Return a valid index of the input list if the passed in object
* is found else return -1.
*/
virtual ossim_int32 findInputIndex(const ossimConnectableObject* object);
/**
* Return a valid index of the input list if the passed id
* is found else return -1.
*/
virtual ossim_int32 findInputIndex(const ossimId& id);
/**
* Return a valid index of the output list if the passed in object
* is found else return -1.
*/
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.
*/
virtual ossim_int32 findOutputIndex(const ossimId& id);
/**
* Should return the first available index to connect to. The
* connectMyInputTo that just takes another ossimConnectableObject as input
* and not an index will call this method. By default this method will find
* the first open slot (not null) or append o the list if it's dynamic. If
* the list is dynamic it calls conConnectMyInputTo(index, object) on an
* index = to listSize.
*/
virtual ossim_int32 getMyInputIndexToConnectTo(
ossimConnectableObject* object)const;
/**
* Should return the first available index to connect to. The
* connectMyOutputTo that just takes another ossimConnectableObject as input\
* and not an index will call this method. By default this method will find
* the first open slot (not null) or append to the list if it's dynamic. If
* the list is dynamic it calls canConnectMyOutputTo(index, object) on an
* index = to listSize.
*/
virtual ossim_int32 getMyOutputIndexToConnectTo(
ossimConnectableObject* object)const;
/**
* required to be overriden by derived classes
*/
virtual bool canConnectMyInputTo(
ossim_int32 myInputIndex, const ossimConnectableObject* object)const=0;
/**
* default implementation is to allow anyone to connect to us.
*/
virtual bool canConnectMyOutputTo(ossim_int32 myOutputIndex,
const ossimConnectableObject* object)const;
/**
* Will disconnect the object passed in.
*/
virtual void disconnect(ossimConnectableObject* object=0);
/**
* Will disconnect the object passed in.
*/
virtual void disconnect(const ossimId& id);
/**
* Will disconnect the object at the given input index and generate
* a connection event.
*/
virtual ossimRefPtr<ossimConnectableObject> disconnectMyInput(
ossim_int32 inputIndex,
bool disconnectOutputFlag=true,
bool createEventFlag = true);
/**
* Finds the index of the passed in input and calls
* disconnectMyInput(inputIndex, disconnectOutputFlag, createEventFlag);
*/
virtual void disconnectMyInput(ossimConnectableObject* input,
bool disconnectOutputFlag=true,
bool createEventFlag = true);
/**
*
*/
virtual void disconnectMyInputs(
ConnectableObjectList& inputList,
bool disconnectOutputFlag=true,
bool createEventFlag=true);
/**
* Will disconnect the object at the given output index and generate
* a connection event. If there is no object at that index then no
* event is generated and NULL is returned. The disconnectOutputFlag
* says do you want this method to disconnect the output pointer to
* this object.
*/
virtual ossimRefPtr<ossimConnectableObject> disconnectMyOutput(
ossim_int32 outputIndex,
bool disconnectInputFlag=true,
bool createEventFlag = true);
/**
* Will disconnect the output object. It will get the index of
* the object and call disconnectMyOutput(index, disconnectOutputFlag).
*/
virtual void disconnectMyOutput(ossimConnectableObject* output,
bool disconnectInputFlag=true,
bool createEventFlag=true);
virtual void disconnectMyOutputs(
ConnectableObjectList& outputList,
bool disconnectOutputFlag=true,
bool createEventFlag=true);
/**
* Will disconnect all of the input objects.
*/
virtual void disconnectAllInputs();
/**
* Will disconnect all of the output objects.
*/
virtual void disconnectAllOutputs();
/**
* Will try to connect this objects input to the passed in object.
* It will return a valid index >= 0 if successful. Will use the
* getMyInputIndexToConnectTo method to implement the connection
*/
virtual ossim_int32 connectMyInputTo(ossimConnectableObject* inputObject,
bool makeOutputConnection=true,
bool createEventFlag=true);
/**
* Will connect the specified input to the passed in object
*/
virtual ossim_int32 connectMyInputTo(ossim_int32 inputIndex,
ossimConnectableObject* inputObject,
bool makeOutputConnection=true,
bool createEventFlag=true);
virtual bool connectMyInputTo(
ConnectableObjectList& inputList,
bool makeOutputConnection=true,
bool createEventFlag = true);
/**
* Will try to connect this objects output to the passed in object.
* It will return a valid index >= 0 if successful. It will in turn call
* the passed in objects connect input command if makeInputConnection
* is set to true.
*
* Will use the getMyOutputIndexToConnectTo to implement this method
*/
virtual ossim_int32 connectMyOutputTo(ossimConnectableObject* outputObject,
bool makeInputConnection=true,
bool createEventFlag=true);
virtual bool connectMyOutputTo(
ConnectableObjectList& outputList,
bool makeInputConnection=true,
bool createEventFlag=true);
/**
* Will disconnect itself from all inputs and reset to the passed in
* input list. It will return true if all objects were successfully
* added.
*/
virtual bool connectInputList(
ConnectableObjectList& inputList);
/**
* Will disconnect itself from all outputs and reset to the passed in
* output list. It will return true if all objects were successfully
* added.
*/
virtual bool connectOutputList(
ConnectableObjectList& outputList);
/**
* Returns the number of input objects.
*/
virtual ossim_uint32 getNumberOfInputs()const;
/**
* Return the number of output objects
*/
virtual ossim_uint32 getNumberOfOutputs()const;
/**
* returns the object at the specified index.
* if the index is not valid then NULL is
* returned
*/
ossimConnectableObject* getInput(ossim_uint32 index=0);
/**
* returns the object at the specified index.
* if the index is not valid then NULL is
* returned
*/
const ossimConnectableObject* getInput(ossim_uint32 index=0)const;
/**
* returns the object at the specified index.
* if the index is not valid then NULL is
* returned
*/
ossimConnectableObject* getOutput(ossim_uint32 index=0);
/**
* returns the object at the specified index.
* if the index is not valid then NULL is
* returned
*/
const ossimConnectableObject* getOutput(ossim_uint32 index=0)const;
/**
* Will set the number of inputs. This will expand the list if the number
* of inputs is larger than the current number of inputs. Will shrink
* the list if the current number of inputs is larger than the passed in
* inputs.
*/
virtual void setNumberOfInputs(ossim_int32 numberOfInputs);
virtual bool getInputListIsFixedFlag()const;
virtual bool getOutputListIsFixedFlag()const;
/**
* Will set the number of outputs. This will expand the list if the
* number of outputs is larger than the current number of outputs.
* Will shrink the list if the current number of outputs is larger than
* the passed in outputs.
*/
virtual void setNumberOfOutputs(ossim_int32 numberOfInputs);
const ConnectableObjectList& getInputList()const;
const ConnectableObjectList& getOutputList()const;
ConnectableObjectList& getInputList();
ConnectableObjectList& getOutputList();
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not achieve exactly
* what you want then you can derive new rules by overriding the virtual
* visit method in ossimVisitor
*
* <pre>
* ossimTypeNameVisitor visitor("<put type name here>",
* false, ossimVisitor::VISIT_CHILDREN);
* connectableObject->accept(visitor);
* ossimCollectionVisitor::List& collection = visitor.getObjects();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual void findAllObjectsOfType(
ConnectableObjectList& result,
const RTTItypeid& typeInfo, bool recurse=true) );
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not achieve exactly
* what you want then you can derive new rules by overriding the virtual
* visit method in ossimVisitor
*
* <pre>
* ossimTypeNameVisitor visitor("<put type name here>", false,
* ossimVisitor::VISIT_CHILDREN);
* connectableObject->accept(visitor);
* ossimCollectionVisitor::List& collection = visitor.getObjects();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual void findAllObjectsOfType(
ConnectableObjectList& result,
const ossimString& className,
bool recurse=true));
#if 0 /* Deprecated code. Left here until thoroughly debugged. (drb) */
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding
* the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeIdVisitor visitor(<put type id here>, false,
* ossimVisitor::VISIT_CHILDREN | ossimVisitor::VISIT_INPUTS);
* connectableObject->accept(visitor);
* ossimCollectionVisitor::List& collection = visitor.getObjects();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual void findAllInputsOfType(
ConnectableObjectList& result,
const RTTItypeid& typeInfo,
bool propagateToInputs=true,
bool recurseChildren=false));
/*!
* These methods are now deprecated. You can achieve the same thing by
* using the new visitor design pattern. If this does not
* achieve exactly what you want then you can derive new rules by overriding
* the virtual visit method in ossimVisitor
*
* <pre>
* ossimTypeNameVisitor visitor("<put type name here>",
* false, ossimVisitor::VISIT_CHILDREN | ossimVisitor::VISIT_INPUTS);
* connectableObject->accept(visitor);
* ossimCollectionVisitor::List& collection = visitor.getObjects();
* </pre>
*/
OSSIM_DEPRECATE_METHOD(virtual void findAllInputsOfType(
ConnectableObjectList& result,
const ossimString& className,
bool propagateToInputs=true,
bool recurseChildren=false));
#endif /* deprecated code. (drb) */
virtual void propagateEventToOutputs(ossimEvent& event);
virtual void propagateEventToInputs(ossimEvent& event);
/* ------------------- PROPERTY INTERFACE -------------------- */
virtual void setProperty(ossimRefPtr<ossimProperty> property);
virtual void setProperty(const ossimString& name, const ossimString& value);
virtual ossimRefPtr<ossimProperty> getProperty(const ossimString& name)const;
virtual void getPropertyNames(std::vector<ossimString>& propertyNames)const;
/* ------------------ PROPERTY INTERFACE END ------------------- */
virtual bool loadState(const ossimKeywordlist& kwl,
const char* prefix = 0);
virtual bool saveState(ossimKeywordlist& kwl,
const char* prefix = 0)const;
/**
* Save the state of all inputs to a keyword list. This will do a
* recursive call through all inputs and save their state to a
* keyword list.
*
* @param kwl Keyword list to save state to.
*
* @param saveThisStateFlag If the true the state of this object will be
* saved as well as all inputs. Default = true.
*
* @param objectIndex Index to be used for prefix. So if
* objectIndex = 1, the first object will have a prefix of: "object1."
* Default = 1.
*
* @param prefix Prefix to tack onto keyword. If prefix = "myChain." and
* objectIndex = 1, then the first keyword would be
* "myChain.object1.some_keyword".
*
* @return Returns the next object index. This is the last index used
* plus one. Used internally to keep track of index to use for prefix.
*/
virtual ossim_uint32 saveStateOfAllInputs(ossimKeywordlist& kwl,
bool saveThisStateFlag=true,
ossim_uint32 objectIndex=1,
const char* prefix=0) const;
/**
* Inserts this object and all of its children and inputs into the container
* provided.
* @return Returns TRUE if successful.
*/
virtual bool fillContainer(ossimConnectableContainer& container);
/**
* Moves the input connection matching id up one in the connection list.
* @param id The id to move.
* @return true if action was performed, false if not.
*/
bool moveInputUp(const ossimId& id);
/**
* Moves the input connection matching id down one in the connection list.
* @param id The id to move.
* @return true if action was performed, false if not.
*/
bool moveInputDown(const ossimId& id);
/**
* Moves the input connection matching id to the top of the connection list.
* @param id The id to move.
* @return true if action was performed, false if not.
*/
bool moveInputToTop(const ossimId& id);
/**
* Moves the input connection matching id to the bottom of the connection
* list.
* @param id The id to move.
* @return true if action was performed, false if not.
*/
bool moveInputToBottom(const ossimId& id);
/**
* We will add a visitor interface for all connectable objects.
*/
virtual void accept(ossimVisitor& visitor);
protected:
ossimConnectableObject* findObjectOfType(
ConnectableObjectList* connectableList,
ossimVisitor& visitor );
ossimId theId;
ossimString theDescription;
ossimObject* theOwner;
/**
* Indicates whether the theInputObjectList is fixed
*/
bool theInputListIsFixedFlag;
/**
* Indicates whether the theOutputObjectList is fixed
*/
bool theOutputListIsFixedFlag;
/**
* Holds a list of input objects.
*/
ConnectableObjectList theInputObjectList;
/**
* Holds a list of output objects.
*/
ConnectableObjectList theOutputObjectList;
private:
TYPE_DATA
};
#endif /* #ifndef ossimConnectableObject_HEADER */
|