#include <map>
#include <set>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <iterator>
#include "log.h"
#include "exception.h"
#include <iostream>
#include <cctype>
Include dependency graph for emobject.h:
This graph shows which files directly or indirectly include this file:
Go to the source code of this file.
Namespaces | |
namespace | EMAN |
Classes | |
class | EMAN::EMConsts |
class | EMAN::EMObject |
EMObject is a wrapper class for types including int, float, double, etc as defined in ObjectType. More... | |
class | EMAN::TypeDict |
TypeDict is a dictionary to store <string, EMObject::ObjectType> pair. More... | |
class | EMAN::Dict |
Dict is a dictionary to store <string, EMObject> pair. More... | |
class | EMAN::Dict::iterator |
Non const iterator support for the Dict object This is just a wrapper, everything is inherited from the map<string,EMObject>::iterator so the interface is the same as you would expect i.e for ( Dict::iterator it = params.begin(); it != params.end(); ++it ). More... | |
class | EMAN::Dict::const_iterator |
Const iterator support for the Dict object This is just a wrapper, everything is inherited from the map<string,EMObject>::cons_iterator so the interface is the same as you would expect i.e for ( Dict::const_iterator it = params.begin(); it != params.end(); ++it ). More... | |
class | EMAN::Factory< T > |
Factory is used to store objects to create new instances. More... | |
class | EMAN::FactoryBase |
A class one may inherit from to ensure that the responsibilities of being incorporated into an EMAN2::Factory are met. More... | |
Defines | |
#define | eman__object__h__ 1 |
| |
Enumerations | |
enum | MapInfoType { NORMAL, ICOS2F_FIRST_OCTANT, ICOS2F_FULL, ICOS2F_HALF, ICOS3F_HALF, ICOS3F_FULL, ICOS5F_HALF, ICOS5F_FULL, ICOS_UNKNOWN } |
Functions | |
bool | operator== (const EMObject &e1, const EMObject &e2) |
bool | operator!= (const EMObject &e1, const EMObject &e2) |
bool | operator== (const Dict &d1, const Dict &d2) |
bool | operator!= (const Dict &d1, const Dict &d2) |
template<class T> | |
void | dump_factory () |
template<class T> | |
map< string, vector< string > > | dump_factory_list () |
|
Definition at line 37 of file emobject.h. |
|
Definition at line 97 of file emobject.h. 00097 { 00098 NORMAL, 00099 ICOS2F_FIRST_OCTANT, 00100 ICOS2F_FULL, 00101 ICOS2F_HALF, 00102 ICOS3F_HALF, 00103 ICOS3F_FULL, 00104 ICOS5F_HALF, 00105 ICOS5F_FULL, 00106 ICOS_UNKNOWN 00107 };
|
|
Definition at line 829 of file emobject.h. References EMAN::TypeDict::dump(). 00830 { 00831 vector < string > item_names = Factory < T >::get_list(); 00832 00833 for (size_t i = 0; i < item_names.size(); i++) { 00834 T *item = Factory < T >::get(item_names[i]); 00835 printf("%s : %s\n", item->get_name().c_str(),item->get_desc().c_str()); 00836 TypeDict td = item->get_param_types(); 00837 td.dump(); 00838 } 00839 }
|
|
Definition at line 841 of file emobject.h. References EMAN::TypeDict::get_desc(), EMAN::TypeDict::get_type(), EMAN::TypeDict::keys(), and EMAN::TypeDict::size(). 00842 { 00843 vector < string > item_names = Factory < T >::get_list(); 00844 map<string, vector<string> > factory_list; 00845 00846 typename vector<string>::const_iterator p; 00847 for(p = item_names.begin(); p !=item_names.end(); ++p) { 00848 T *item = Factory<T>::get(*p); 00849 00850 string name = item->get_name(); 00851 00852 vector<string> content; 00853 content.push_back(item->get_desc()); 00854 TypeDict td = item->get_param_types(); 00855 vector<string> keys = td.keys(); 00856 for(unsigned int i=0; i<td.size(); ++i) { 00857 content.push_back(keys[i]); 00858 content.push_back( td.get_type(keys[i]) ); 00859 content.push_back( td.get_desc(keys[i]) ); 00860 } 00861 factory_list[name] = content; 00862 } 00863 00864 return factory_list; 00865 }
|
|
Definition at line 1047 of file emobject.cpp. 01048 {
01049 return !(d1 == d2);
01050 }
|
|
Definition at line 896 of file emobject.cpp. 00897 {
00898 return !(e1 == e2);
00899 }
|
|
Definition at line 1041 of file emobject.cpp. References EMAN::Dict::dict. 01042 { 01043 // Just make use of map's version of operator== 01044 return (d1.dict == d2.dict); 01045 }
|
|
Definition at line 796 of file emobject.cpp. References EMAN::EMObject::b, EMAN::EMObject::d, EMAN::EMObject::emdata, EMAN::EMObject::f, EMAN::EMObject::farray, EMAN::EMObject::fp, EMAN::EMObject::iarray, EMAN::EMObject::ip, EMAN::EMObject::n, EMAN::EMObject::str, EMAN::EMObject::strarray, EMAN::EMObject::transformarray, EMAN::EMObject::type, EMAN::EMObject::ui, EMAN::EMObject::vp, and EMAN::EMObject::xydata. 00797 { 00798 00799 if (e1.type != e2.type) { 00800 return false; 00801 } 00802 00803 switch (e1.type) { 00804 case EMObject::BOOL: 00805 return (e1.b == e2.b); 00806 break; 00807 case EMObject::INT: 00808 return (e1.n == e2.n); 00809 break; 00810 case EMObject::UNSIGNEDINT: 00811 return (e1.ui == e2.ui); 00812 break; 00813 case EMObject::FLOAT: 00814 return (e1.f == e2.f); 00815 break; 00816 case EMObject::DOUBLE: 00817 return (e1.d == e2.d); 00818 break; 00819 case EMObject::CTF: 00820 case EMObject::STRING: 00821 return (e1.str == e2.str); 00822 break; 00823 case EMObject::FLOAT_POINTER: 00824 return (e1.fp == e2.fp); 00825 break; 00826 case EMObject::INT_POINTER: 00827 return (e1.ip == e2.ip); 00828 break; 00829 case EMObject::VOID_POINTER: 00830 return (e1.vp == e2.vp); 00831 break; 00832 case EMObject::EMDATA: 00833 return (e1.emdata == e2.emdata); 00834 break; 00835 case EMObject::XYDATA: 00836 return (e1.xydata == e2.xydata); 00837 break; 00838 case EMObject::TRANSFORM: 00839 case EMObject::FLOATARRAY: 00840 if (e1.farray.size() == e2.farray.size()) { 00841 for (size_t i = 0; i < e1.farray.size(); i++) { 00842 if (e1.farray[i] != e2.farray[i]) { 00843 return false; 00844 } 00845 } 00846 return true; 00847 } 00848 else { 00849 return false; 00850 } 00851 break; 00852 case EMObject::INTARRAY: 00853 if (e1.iarray.size() == e2.iarray.size()) { 00854 for (size_t i = 0; i < e1.iarray.size(); i++) { 00855 if (e1.iarray[i] != e2.iarray[i]) { 00856 return false; 00857 } 00858 } 00859 return true; 00860 } 00861 break; 00862 case EMObject::STRINGARRAY: 00863 if (e1.strarray.size() == e2.strarray.size()) { 00864 for (size_t i = 0; i < e1.strarray.size(); i++) { 00865 if (e1.strarray[i] != e2.strarray[i]) { 00866 return false; 00867 } 00868 } 00869 return true; 00870 } 00871 else { 00872 return false; 00873 } 00874 break; 00875 case EMObject::TRANSFORMARRAY: 00876 if (e1.transformarray.size() == e2.transformarray.size()) { 00877 for (size_t i = 0; i < e1.transformarray.size(); i++) { 00878 if (e1.transformarray[i] != e2.transformarray[i]) { 00879 return false; 00880 } 00881 } 00882 } 00883 break; 00884 case EMObject::UNKNOWN: 00885 // UNKNOWN really means "no type" and if two objects both have 00886 // type UNKNOWN they really are the same 00887 return (e1.type == e2.type); 00888 break; 00889 default: 00890 return false; 00891 break; 00892 } 00893 return false; 00894 }
|