[opengtl-commits] [612] add a function to return only a given type of kernels

[ Thread Index | Date Index | More lists.tuxfamily.org/opengtl-commits Archives ]


Revision: 612
Author:   cyrille
Date:     2009-03-13 21:41:44 +0100 (Fri, 13 Mar 2009)

Log Message:
-----------
add a function to return only a given type of kernels

Modified Paths:
--------------
    trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.cpp
    trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.h


Modified: trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.cpp
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.cpp	2009-03-13 20:37:42 UTC (rev 611)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.cpp	2009-03-13 20:41:44 UTC (rev 612)
@@ -79,4 +79,15 @@
   return d->kernels;
 }
 
-
+std::list< Source* > SourcesCollection::sources(Source::SourceType _source) const
+{
+  std::list< Source* > sources;
+  foreach(Source* source,d->kernels)
+  {
+    if(source->sourceType() == _source)
+    {
+      sources.push_back(source);
+    }
+  }
+  return sources;
+}

Modified: trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.h
===================================================================
--- trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.h	2009-03-13 20:37:42 UTC (rev 611)
+++ trunk/OpenGTL/OpenShiva/OpenShiva/SourcesCollection.h	2009-03-13 20:41:44 UTC (rev 612)
@@ -21,13 +21,13 @@
 #define _OPENSHIVA_KERNELS_COLLECTION_H_
 
 #include <list>
+#include <OpenShiva/Source.h>
 
 namespace GTLCore {
   class String;
 }
 
 namespace OpenShiva {
-  class Source;
   /**
    * @ingroup OpenShiva
    * 
@@ -53,6 +53,10 @@
        * @return the list of kernels in the collection
        */
       const std::list< Source* >& sources() const;
+      /**
+       * @return the list of sources in the collection that have the type given in argument.
+       */
+      std::list< Source* > sources(Source::SourceType _source) const;
     private:
       struct Private;
       Private* const d;


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/