ObjectProperties.cpp
Go to the documentation of this file.
00001 /*******************************************************************************
00002  *  ObjectProperties.cpp
00003  *
00004  *  (C) 2008 AG Aktives Sehen <agas@uni-koblenz.de>
00005  *           Universitaet Koblenz-Landau
00006  *
00007  *  Information on Code Review state:
00008  *  Author: <initials>; DevelTest: Date; Reviewer: Initials; Review: Date; State: NOK
00009  *
00010  *  Additional information:
00011  *  $Id: ObjectProperties.cpp 31722 2009-04-23 12:48:01Z sisuthie $
00012  *******************************************************************************/
00013 
00014 
00015 #include "ObjectProperties.h"
00016 
00017 #include "Architecture/Singleton/Clock.h"
00018 
00019 #define THIS ObjectProperties
00020 
00021 THIS::THIS( std::string name )
00022 {
00023     m_Name=name;
00024     m_Type="";
00025 }
00026 
00027 
00028 THIS::~THIS()
00029 {
00030     for ( unsigned i=0; i < m_ImageProperties.size(); i++)
00031     {
00032         if ( m_ImageProperties[i] ) { delete m_ImageProperties[i]; }
00033     }
00034 }
00035 
00036 
00037 THIS::THIS(const ObjectProperties& other)
00038 {
00039     *this = other;
00040 }
00041 
00042 
00043 THIS& THIS::operator=(const ObjectProperties& other)
00044                      {
00045     for ( unsigned i=0; i < m_ImageProperties.size(); i++)
00046     {
00047         if ( m_ImageProperties[i] ) { delete m_ImageProperties[i]; }
00048     }
00049     m_ImageProperties.clear();
00050 
00051     //copy new data
00052     m_Name = other.m_Name;
00053     m_Type = other.m_Type;
00054 
00055     for ( unsigned i=0; i < other.m_ImageProperties.size(); i++)
00056     {
00057         m_ImageProperties.push_back( new ImagePropertiesCV( *(other.m_ImageProperties[i]) ) );
00058     }
00059 
00060     return *this;
00061 }
00062 
00063 void THIS::addImageProperties( ImagePropertiesCV* imageProperties )
00064 {
00065     m_ImageProperties.push_back( imageProperties );
00066 }
00067 
00068 void THIS::deleteImageProperties( std::string name )
00069 {
00070   std::vector<ImagePropertiesCV*> newImageProperties;
00071 
00072   for ( unsigned i=0; i<m_ImageProperties.size(); i++ )
00073   {
00074     if ( m_ImageProperties[i]->getName() == name )
00075     {
00076       delete m_ImageProperties[i];
00077     }
00078     else
00079     {
00080       newImageProperties.push_back( m_ImageProperties[i] );
00081     }
00082   }
00083 
00084   m_ImageProperties = newImageProperties;
00085 }
00086 
00087 void THIS::deleteImageProperties( int index )
00088 {
00089   std::vector<ImagePropertiesCV*> newImageProperties;
00090 
00091   for ( unsigned i=0; i<m_ImageProperties.size(); i++ )
00092   {
00093     if ( i == (unsigned) index )
00094     {
00095       delete m_ImageProperties[i];
00096     }
00097     else
00098     {
00099       newImageProperties.push_back( m_ImageProperties[i] );
00100     }
00101   }
00102 
00103   m_ImageProperties = newImageProperties;
00104 }
00105 
00106 const ImagePropertiesCV* THIS::getImageProperties( std::string name ) const
00107 {
00108   for ( unsigned i=0; i<m_ImageProperties.size(); i++ )
00109   {
00110     if ( m_ImageProperties[i]->getName() == name )
00111     {
00112       return m_ImageProperties[i];
00113     }
00114   }
00115   return 0;
00116 }
00117 
00118 std::vector<std::string> THIS::getImageNames()
00119 {
00120   std::vector<std::string> result;
00121   result.reserve( m_ImageProperties.size() );
00122 
00123   for ( unsigned i=0; i<m_ImageProperties.size(); i++ )
00124   {
00125     result.push_back( m_ImageProperties[i]->getName() );
00126 //     TRACE_INFO( m_ImageProperties[i]->getName() )
00127   }
00128 
00129 
00130   return result;
00131 }
00132 
00133 
00134 void THIS::printOn( std::ostream& strm )
00135 {
00136     unsigned size=m_ImageProperties.size();
00137 
00138     strm << "Object name: " << m_Name << std::endl;
00139     strm << "Object type: " << m_Type << std::endl;
00140     strm << "# of images: " << size << std::endl << std::endl;
00141 
00142     strm << "Number keypoints in images:";
00143     for ( unsigned i=0; i < size; i++)
00144     {
00145         strm << " " << m_ImageProperties[i]->getKeyPoints()->size();
00146     }
00147 
00148     strm << std::endl << std::endl;
00149 }
00150 
00151 #undef THIS


or_libs
Author(s): raphael
autogenerated on Mon Oct 6 2014 02:53:18