#include <map>
#include <set>
#include <vector>
#include <string>
#include <utility>
#include <algorithm>
#include <iterator>
#include "log.h"
#include "exception.h"
#include <cstdio>
#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 98 of file emobject.h. 00098 { 00099 NORMAL, 00100 ICOS2F_FIRST_OCTANT, 00101 ICOS2F_FULL, 00102 ICOS2F_HALF, 00103 ICOS3F_HALF, 00104 ICOS3F_FULL, 00105 ICOS5F_HALF, 00106 ICOS5F_FULL, 00107 ICOS_UNKNOWN 00108 };
|
|
Definition at line 834 of file emobject.h. References EMAN::TypeDict::dump(). 00835 { 00836 vector < string > item_names = Factory < T >::get_list(); 00837 00838 for (size_t i = 0; i < item_names.size(); i++) { 00839 T *item = Factory < T >::get(item_names[i]); 00840 printf("%s : %s\n", item->get_name().c_str(),item->get_desc().c_str()); 00841 TypeDict td = item->get_param_types(); 00842 td.dump(); 00843 } 00844 }
|
|
Definition at line 846 of file emobject.h. References EMAN::TypeDict::get_desc(), EMAN::TypeDict::get_type(), EMAN::TypeDict::keys(), and EMAN::TypeDict::size(). 00847 { 00848 vector < string > item_names = Factory < T >::get_list(); 00849 map<string, vector<string> > factory_list; 00850 00851 typename vector<string>::const_iterator p; 00852 for(p = item_names.begin(); p !=item_names.end(); ++p) { 00853 T *item = Factory<T>::get(*p); 00854 00855 string name = item->get_name(); 00856 00857 vector<string> content; 00858 content.push_back(item->get_desc()); 00859 TypeDict td = item->get_param_types(); 00860 vector<string> keys = td.keys(); 00861 for(unsigned int i=0; i<td.size(); ++i) { 00862 content.push_back(keys[i]); 00863 content.push_back( td.get_type(keys[i]) ); 00864 content.push_back( td.get_desc(keys[i]) ); 00865 } 00866 factory_list[name] = content; 00867 } 00868 00869 return factory_list; 00870 }
|
|
Definition at line 1098 of file emobject.cpp. 01099 {
01100 return !(d1 == d2);
01101 }
|
|
Definition at line 944 of file emobject.cpp. 00945 {
00946 return !(e1 == e2);
00947 }
|
|
Definition at line 1092 of file emobject.cpp. References EMAN::Dict::dict. 01093 { 01094 // Just make use of map's version of operator== 01095 return (d1.dict == d2.dict); 01096 }
|
|
Definition at line 841 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::si, EMAN::EMObject::str, EMAN::EMObject::strarray, EMAN::EMObject::transformarray, EMAN::EMObject::type, EMAN::EMObject::ui, EMAN::EMObject::vp, and EMAN::EMObject::xydata. 00842 { 00843 00844 if (e1.type != e2.type) { 00845 return false; 00846 } 00847 00848 switch (e1.type) { 00849 case EMObject::BOOL: 00850 return (e1.b == e2.b); 00851 break; 00852 case EMObject::SHORT: 00853 return (e1.si == e2.si); 00854 break; 00855 case EMObject::INT: 00856 return (e1.n == e2.n); 00857 break; 00858 case EMObject::UNSIGNEDINT: 00859 return (e1.ui == e2.ui); 00860 break; 00861 case EMObject::FLOAT: 00862 return (e1.f == e2.f); 00863 break; 00864 case EMObject::DOUBLE: 00865 return (e1.d == e2.d); 00866 break; 00867 case EMObject::CTF: 00868 case EMObject::STRING: 00869 return (e1.str == e2.str); 00870 break; 00871 case EMObject::FLOAT_POINTER: 00872 return (e1.fp == e2.fp); 00873 break; 00874 case EMObject::INT_POINTER: 00875 return (e1.ip == e2.ip); 00876 break; 00877 case EMObject::VOID_POINTER: 00878 return (e1.vp == e2.vp); 00879 break; 00880 case EMObject::EMDATA: 00881 return (e1.emdata == e2.emdata); 00882 break; 00883 case EMObject::XYDATA: 00884 return (e1.xydata == e2.xydata); 00885 break; 00886 case EMObject::TRANSFORM: 00887 case EMObject::FLOATARRAY: 00888 if (e1.farray.size() == e2.farray.size()) { 00889 for (size_t i = 0; i < e1.farray.size(); i++) { 00890 if (e1.farray[i] != e2.farray[i]) { 00891 return false; 00892 } 00893 } 00894 return true; 00895 } 00896 else { 00897 return false; 00898 } 00899 break; 00900 case EMObject::INTARRAY: 00901 if (e1.iarray.size() == e2.iarray.size()) { 00902 for (size_t i = 0; i < e1.iarray.size(); i++) { 00903 if (e1.iarray[i] != e2.iarray[i]) { 00904 return false; 00905 } 00906 } 00907 return true; 00908 } 00909 break; 00910 case EMObject::STRINGARRAY: 00911 if (e1.strarray.size() == e2.strarray.size()) { 00912 for (size_t i = 0; i < e1.strarray.size(); i++) { 00913 if (e1.strarray[i] != e2.strarray[i]) { 00914 return false; 00915 } 00916 } 00917 return true; 00918 } 00919 else { 00920 return false; 00921 } 00922 break; 00923 case EMObject::TRANSFORMARRAY: 00924 if (e1.transformarray.size() == e2.transformarray.size()) { 00925 for (size_t i = 0; i < e1.transformarray.size(); i++) { 00926 if (e1.transformarray[i] != e2.transformarray[i]) { 00927 return false; 00928 } 00929 } 00930 } 00931 break; 00932 case EMObject::UNKNOWN: 00933 // UNKNOWN really means "no type" and if two objects both have 00934 // type UNKNOWN they really are the same 00935 return (e1.type == e2.type); 00936 break; 00937 default: 00938 return false; 00939 break; 00940 } 00941 return false; 00942 }
|