#include <map>
#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 94 of file emobject.h. 00094 { 00095 NORMAL, 00096 ICOS2F_FIRST_OCTANT, 00097 ICOS2F_FULL, 00098 ICOS2F_HALF, 00099 ICOS3F_HALF, 00100 ICOS3F_FULL, 00101 ICOS5F_HALF, 00102 ICOS5F_FULL, 00103 ICOS_UNKNOWN 00104 };
|
|
Definition at line 822 of file emobject.h. References EMAN::TypeDict::dump(). 00823 { 00824 vector < string > item_names = Factory < T >::get_list(); 00825 00826 for (size_t i = 0; i < item_names.size(); i++) { 00827 T *item = Factory < T >::get(item_names[i]); 00828 printf("%s : %s\n", item->get_name().c_str(),item->get_desc().c_str()); 00829 TypeDict td = item->get_param_types(); 00830 td.dump(); 00831 } 00832 }
|
|
Definition at line 834 of file emobject.h. References EMAN::TypeDict::get_desc(), EMAN::TypeDict::get_type(), EMAN::TypeDict::keys(), and EMAN::TypeDict::size(). 00835 { 00836 vector < string > item_names = Factory < T >::get_list(); 00837 map<string, vector<string> > factory_list; 00838 00839 typename vector<string>::const_iterator p; 00840 for(p = item_names.begin(); p !=item_names.end(); ++p) { 00841 T *item = Factory<T>::get(*p); 00842 00843 string name = item->get_name(); 00844 00845 vector<string> content; 00846 content.push_back(item->get_desc()); 00847 TypeDict td = item->get_param_types(); 00848 vector<string> keys = td.keys(); 00849 for(unsigned int i=0; i<td.size(); ++i) { 00850 content.push_back(keys[i]); 00851 content.push_back( td.get_type(keys[i]) ); 00852 content.push_back( td.get_desc(keys[i]) ); 00853 } 00854 factory_list[name] = content; 00855 } 00856 00857 return factory_list; 00858 }
|
|
Definition at line 903 of file emobject.cpp. 00904 {
00905 return !(d1 == d2);
00906 }
|
|
Definition at line 759 of file emobject.cpp. 00760 {
00761 return !(e1 == e2);
00762 }
|
|
Definition at line 897 of file emobject.cpp. References EMAN::Dict::dict. 00898 { 00899 // Just make use of map's version of operator== 00900 return (d1.dict == d2.dict); 00901 }
|
|
Definition at line 668 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::type, EMAN::EMObject::ui, EMAN::EMObject::vp, and EMAN::EMObject::xydata. 00669 { 00670 00671 if (e1.type != e2.type) { 00672 return false; 00673 } 00674 00675 switch (e1.type) { 00676 case EMObject::BOOL: 00677 return (e1.b == e2.b); 00678 break; 00679 case EMObject::INT: 00680 return (e1.n == e2.n); 00681 break; 00682 case EMObject::UNSIGNEDINT: 00683 return (e1.ui == e2.ui); 00684 break; 00685 case EMObject::FLOAT: 00686 return (e1.f == e2.f); 00687 break; 00688 case EMObject::DOUBLE: 00689 return (e1.d == e2.d); 00690 break; 00691 case EMObject::CTF: 00692 case EMObject::STRING: 00693 return (e1.str == e2.str); 00694 break; 00695 case EMObject::FLOAT_POINTER: 00696 return (e1.fp == e2.fp); 00697 break; 00698 case EMObject::INT_POINTER: 00699 return (e1.ip == e2.ip); 00700 break; 00701 case EMObject::VOID_POINTER: 00702 return (e1.vp == e2.vp); 00703 break; 00704 case EMObject::EMDATA: 00705 return (e1.emdata == e2.emdata); 00706 break; 00707 case EMObject::XYDATA: 00708 return (e1.xydata == e2.xydata); 00709 break; 00710 case EMObject::TRANSFORM: 00711 case EMObject::FLOATARRAY: 00712 if (e1.farray.size() == e2.farray.size()) { 00713 for (size_t i = 0; i < e1.farray.size(); i++) { 00714 if (e1.farray[i] != e2.farray[i]) { 00715 return false; 00716 } 00717 } 00718 return true; 00719 } 00720 else { 00721 return false; 00722 } 00723 break; 00724 case EMObject::INTARRAY: 00725 if (e1.iarray.size() == e2.iarray.size()) { 00726 for (size_t i = 0; i < e1.iarray.size(); i++) { 00727 if (e1.iarray[i] != e2.iarray[i]) { 00728 return false; 00729 } 00730 } 00731 return true; 00732 } 00733 break; 00734 case EMObject::STRINGARRAY: 00735 if (e1.strarray.size() == e2.strarray.size()) { 00736 for (size_t i = 0; i < e1.strarray.size(); i++) { 00737 if (e1.strarray[i] != e2.strarray[i]) { 00738 return false; 00739 } 00740 } 00741 return true; 00742 } 00743 else { 00744 return false; 00745 } 00746 break; 00747 case EMObject::UNKNOWN: 00748 // UNKNOWN really means "no type" and if two objects both have 00749 // type UNKNOWN they really are the same 00750 return (e1.type == e2.type); 00751 break; 00752 default: 00753 return false; 00754 break; 00755 } 00756 return false; 00757 }
|