shader_map.h

Go to the documentation of this file.
00001 
00002 // Copyright 1986-2009 by mental images GmbH, Fasanenstr. 81, D-10623 Berlin,
00003 // Germany. All rights reserved.
00005 // Created:     27.02.08
00006 // Module:      api
00007 // Purpose:     mental ray C++ shader interface extensions
00009 
00018 
00019 
00020 #ifndef SHADER_MAP_H
00021 #define SHADER_MAP_H
00022 
00023 #include "mi_shader_if.h"
00024 
00025 namespace mi {
00026 namespace shader_v3 {
00027 
00033 class Map_status {
00034     public:
00036         enum Status_code {
00037             OK = 0,                     
00038 
00039             Insufficient_memory,        
00040             No_such_field,              
00041             Out_of_bounds,              
00042             No_declaration,             
00043             Declaration_mismatch,       
00044             Wrong_dimension,            
00045 
00046             File_could_not_be_opened = 16,  
00047             File_not_a_map,                 
00048             File_version_unsupported,       
00049 
00050             Field_undefined = 32,       
00051             Field_name_too_long,        
00052             Field_name_empty,           
00053             Field_name_illegal,         
00054             Field_null_array,           
00055             Field_type_mismatch,        
00056 
00057             Iterator_invalid = 48,      
00058             Iterator_past_end,          
00059             Iterator_out_of_bounds,     
00060 
00061             Lookup_invalid = 64,        
00062             Lookup_past_end,            
00063             Lookup_out_of_bounds,       
00064             Lookup_dimension_mismatch   
00065         };
00066 
00068         Map_status()
00069             : m_status(OK)
00070         {}
00071 
00074         Map_status(Status_code status)
00075             : m_status(status)
00076         {}
00077 
00080         Map_status(const Map_status& status)
00081             : m_status(status.m_status)
00082         {}
00083 
00087         Map_status& operator=(const Status_code& rhs)
00088         {m_status=rhs;return *this;}
00089 
00093         Map_status& operator=(const Map_status& rhs)
00094         {m_status=rhs.m_status;return *this;}
00095 
00099         bool operator==(const Status_code rhs) const
00100         {return m_status==rhs;}
00101 
00105         bool operator==(const Map_status& rhs) const
00106         {return m_status==rhs.m_status;}
00107 
00111         bool operator!=(const Status_code rhs) const
00112         {return m_status!=rhs;}
00113 
00117         bool operator!=(const Map_status& rhs) const
00118         {return m_status!=rhs.m_status;}
00119 
00122         bool is_ok() const
00123         {return m_status==OK;}
00124 
00127         Status_code status() const
00128         {return m_status;}
00129 
00130     private:
00132         Status_code m_status;
00133 };
00134 
00140 class Map_field_type {
00141     public:
00143         enum Type {
00144             Undefined = 0,          
00145 
00146             Scalar,                 
00147             Integer,                
00148             Vector,                 
00149             Color,                  
00150             Transform,              
00151 
00152             Scalar_array = 16,      
00153             Integer_array           
00154         };
00155 
00157         Map_field_type()
00158             : m_type(Undefined)
00159         {}
00160 
00163         Map_field_type(Type type)
00164             : m_type(type)
00165         {}
00166 
00169         Map_field_type(const Map_field_type& type)
00170             : m_type(type.m_type)
00171         {}
00172 
00176         Map_field_type& operator=(const Type& rhs)
00177         {m_type=rhs;return *this;}
00178 
00182         Map_field_type& operator=(const Map_field_type& rhs)
00183         {m_type=rhs.m_type;return *this;}
00184 
00188         bool operator==(const Type rhs) const
00189         {return m_type==rhs;}
00190 
00194         bool operator==(const Map_field_type& rhs) const
00195         {return m_type==rhs.m_type;}
00196 
00200         bool operator!=(const Type rhs) const
00201         {return m_type!=rhs;}
00202 
00206         bool operator!=(const Map_field_type& rhs) const
00207         {return m_type!=rhs.m_type;}
00208 
00211         Type type() const
00212         {return m_type;}
00213 
00214     private:
00216         Type m_type;
00217 };
00218 
00221 typedef miUint Map_field_id;
00222 
00224 class Map_declaration;
00225 class Map_element;
00226 class Map_lookup;
00227 
00243 class Map_base {
00244     public:
00247         virtual miUint size() const = 0;
00248 
00251         virtual bool is_empty() const = 0;
00252 
00255         virtual bool has_declaration() const = 0;
00256 
00261         virtual Map_status get(
00262             const miUint    index,
00263             Map_element     &map_element) const = 0;
00264 
00269         virtual Map_status set(
00270             const miUint        index,
00271             const Map_element   &map_element) = 0;
00272 
00276         virtual Map_status append(
00277             const Map_element   &map_element) = 0;
00278 
00282         virtual Map_status read(
00283             const char  *file_name) = 0;
00284 
00288         virtual Map_status append_to(
00289             const char  *file_name) const = 0;
00290 
00294         virtual Map_status append_from(
00295             const char  *file_name) = 0;
00296 
00300         virtual Map_status write(
00301             const char  *file_name) const = 0;
00302 };
00303 
00307 class Access_map_dbhandle {
00308 public:
00311     virtual const Map_base * operator->() = 0;
00312 
00314     virtual void release() const = 0;
00315 
00318     virtual miTag get_tag() const = 0;
00319 
00322     virtual miTag store() = 0;
00323 };
00324 
00328 typedef Access_map_dbhandle Map_dbhandle_access;
00329 
00334 class Access_map {
00335 public:
00338     Access_map(
00339         const miTag tag);
00340 
00344     Access_map(
00345         const char *filename,
00346         Map_status *status = 0);
00347 
00349     ~Access_map();
00350 
00353     const Map_base * operator->();
00354 
00357     const Map_base * operator->() const;
00358 
00361     miTag get_tag() const;
00362 
00365     miTag store();
00366 
00367 private:
00368     Access_map();
00369     Access_map(const Access_map &);
00370     const Access_map & operator=(const Access_map &);
00371 
00372     Access_map_dbhandle *m_map_h;
00373 };
00374 
00378 typedef Access_map Map_access;
00379 
00383 class Edit_map_dbhandle {
00384 public:
00387     virtual Map_base * operator->() = 0;
00388 
00390     virtual void release() const = 0;
00391 
00394     virtual miTag get_tag() const = 0;
00395 
00398     virtual miTag store() = 0;
00399 };
00400 
00404 typedef Edit_map_dbhandle Map_dbhandle_edit;
00405 
00411 class Edit_map {
00412 public:
00415     Edit_map(
00416         const Map_declaration &map_declaration);
00417 
00419     Edit_map();
00420 
00423     Edit_map(
00424         const miTag tag);
00425 
00429     Edit_map(
00430         const char *filename,
00431         Map_status *status = 0);
00432 
00434     ~Edit_map();
00435 
00438     Map_base * operator->();
00439 
00442     const Map_base * operator->() const;
00443 
00446     miTag get_tag() const;
00447 
00450     miTag store();
00451 
00452 private:
00453     Edit_map(const Edit_map &);
00454     const Edit_map & operator=(const Edit_map &);
00455 
00456     Edit_map_dbhandle *m_map_h;
00457 };
00458 
00462 typedef Edit_map Map_edit;
00463 
00485 class Map_declaration_base {
00486     public:
00488         virtual void release() const = 0;
00489 
00492         virtual miUint size() const = 0;
00493 
00497         virtual bool is_empty() const = 0;
00498 
00501         virtual miUint get_dimension() const = 0;
00502 
00509         virtual bool is_equivalent(
00510             const Map_declaration   &other,
00511             Map_status              *status = 0) const = 0;
00512 
00519         virtual bool matches(
00520             const Map_declaration   &other,
00521             Map_status              *status = 0) const = 0;
00522 
00528         virtual bool has_field(
00529             const char  *name,
00530             Map_status  *status = 0) const = 0;
00531 
00538         virtual Map_status add(
00539             const char              *name,
00540             const Map_field_type    type,
00541             const miUint            dim = 0) = 0;
00542 
00546         virtual Map_status add_scalar(
00547             const char      *name) = 0;
00548 
00552         virtual Map_status add_integer(
00553             const char      *name) = 0;
00554 
00558         virtual Map_status add_vector(
00559             const char      *name) = 0;
00560 
00564         virtual Map_status add_color(
00565             const char      *name) = 0;
00566 
00570         virtual Map_status add_transform(
00571             const char      *name) = 0;
00572 
00577         virtual Map_status add_scalar_array(
00578             const char      *name,
00579             const miUint    dim) = 0;
00580 
00585         virtual Map_status add_integer_array(
00586             const char      *name,
00587             const miUint    dim) = 0;
00588 
00593         virtual const char* get_field_name(
00594             const Map_field_id  field_id,
00595             Map_status          *status = 0) const = 0;
00596 
00601         virtual Map_field_id get_field_id(
00602             const char      *field_name,
00603             Map_status      *status = 0) const = 0;
00604 
00610         virtual Map_status get_field_type_dim(
00611             const Map_field_id  field_id,
00612             Map_field_type      &field_type,
00613             miUint              &field_dimension) const = 0;
00614 
00620         virtual Map_status get_field_type_dim(
00621             const char          *field_name,
00622             Map_field_type      &field_type,
00623             miUint              &field_dimension) const = 0;
00624 };
00625 
00632 class Map_declaration {
00633 public:
00636     Map_declaration(
00637         const miUint dimension=3);
00638 
00642     Map_declaration(
00643         const Access_map &map,
00644         Map_status *status = 0);
00645 
00649     Map_declaration(
00650         const Edit_map &map,
00651         Map_status *status = 0);
00652 
00656     Map_declaration(
00657         const Map_element &map_element,
00658         Map_status *status = 0);
00659 
00663     Map_declaration(
00664         const Map_declaration &other,
00665         Map_status *status = 0);
00666 
00668     ~Map_declaration();
00669 
00672     Map_declaration & operator=(
00673         const Map_declaration &other);
00674 
00677     Map_declaration_base * operator->();
00678 
00681     const Map_declaration_base * operator->() const;
00682 
00683 private:
00684     Map_declaration_base *m_map_declaration;
00685 };
00686 
00710 class Map_element_base {
00711     public:
00713         virtual void release() const = 0;
00714 
00718         virtual Map_status set_declaration(
00719             const Map_declaration&  declaration) = 0;
00720 
00724         virtual Map_status get_position(
00725             float               *position) const = 0;
00726 
00730         virtual Map_status get_position(
00731             miVector            &position) const = 0;
00732 
00737         virtual Map_status get(
00738             const Map_field_id  field_id,
00739             float               &value) const = 0;
00740 
00745         virtual Map_status get(
00746             const Map_field_id  field_id,
00747             int                 &value) const = 0;
00748 
00753         virtual Map_status get(
00754             const Map_field_id  field_id,
00755             miVector            &value) const = 0;
00756 
00761         virtual Map_status get(
00762             const Map_field_id  field_id,
00763             miColor             &value) const = 0;
00764 
00770         virtual Map_status get(
00771             const Map_field_id  field_id,
00772             miMatrix            *value) const = 0;
00773 
00778         virtual Map_status get(
00779             const Map_field_id  field_id,
00780             float               *value) const = 0;
00781 
00786         virtual Map_status get(
00787             const Map_field_id  field_id,
00788             int                 *value) const = 0;
00789 
00793         virtual Map_status set_position(
00794             const float         *position) = 0;
00795 
00799         virtual Map_status set_position(
00800             const miVector      &position) = 0;
00801 
00806         virtual Map_status set(
00807             const Map_field_id  field_id,
00808             const float         value) = 0;
00809 
00814         virtual Map_status set(
00815             const Map_field_id  field_id,
00816             const int           value) = 0;
00817 
00822         virtual Map_status set(
00823             const Map_field_id  field_id,
00824             const miVector      &value) = 0;
00825 
00830         virtual Map_status set(
00831             const Map_field_id  field_id,
00832             const miColor       &value) = 0;
00833 
00839         virtual Map_status set(
00840             const Map_field_id  field_id,
00841             const miMatrix      *value) = 0;
00842 
00847         virtual Map_status set(
00848             const Map_field_id  field_id,
00849             const float         *value) = 0;
00850 
00855         virtual Map_status set(
00856             const Map_field_id  field_id,
00857             const int           *value) = 0;
00858 };
00859 
00864 class Map_element {
00865 public:
00868     Map_element();
00869 
00873     Map_element(
00874         const Map_declaration& declaration);
00875 
00878     Map_element(
00879         const Map_element &other);
00880 
00882     ~Map_element();
00883 
00886     Map_element & operator=(
00887         const Map_element &other);
00888 
00891     Map_element_base * operator->();
00892 
00895     const Map_element_base * operator->() const;
00896 
00897 private:
00898     Map_element_base *m_map_element;
00899 };
00900 
00925 class Map_iterator_base {
00926     public:
00928         virtual void release() const = 0;
00929 
00932         virtual Map_status reset() const = 0;
00933 
00937         virtual Map_status set_to(
00938             const miUint    index) const = 0;
00939 
00942         virtual Map_status next() const = 0;
00943 
00946         virtual Map_status previous() const = 0;
00947 
00951         virtual Map_status skip(
00952             const miUint    amount) const = 0;
00953 
00957         virtual bool at_end(
00958             Map_status  *status = 0) const = 0;
00959 
00963         virtual miUint current(
00964             Map_status  *status = 0) const = 0;
00965 
00969         virtual Map_status get(
00970             Map_element         &element) const = 0;
00971 
00975         virtual Map_status get_position(
00976             float               *position) const = 0;
00977 
00981         virtual Map_status get_position(
00982             miVector            &position) const = 0;
00983 
00989         virtual Map_status get(
00990             const Map_field_id  field_id,
00991             float               &value) const = 0;
00992 
00998         virtual Map_status get(
00999             const Map_field_id  field_id,
01000             int                 &value) const = 0;
01001 
01007         virtual Map_status get(
01008             const Map_field_id  field_id,
01009             miVector            &value) const = 0;
01010 
01016         virtual Map_status get(
01017             const Map_field_id  field_id,
01018             miColor             &value) const = 0;
01019 
01026         virtual Map_status get(
01027             const Map_field_id  field_id,
01028             miMatrix            *value) const = 0;
01029 
01035         virtual Map_status get(
01036             const Map_field_id  field_id,
01037             float               *value) const = 0;
01038 
01044         virtual Map_status get(
01045             const Map_field_id  field_id,
01046             int                 *value) const = 0;
01047 
01051         virtual Map_status set(
01052             const Map_element   &element) = 0;
01053 
01057         virtual Map_status set_position(
01058             const float         *position) = 0;
01059 
01063         virtual Map_status set_position(
01064             const miVector      &position) = 0;
01065 
01071         virtual Map_status set(
01072             const Map_field_id  field_id,
01073             const float         value) = 0;
01074 
01080         virtual Map_status set(
01081             const Map_field_id  field_id,
01082             const int           value) = 0;
01083 
01089         virtual Map_status set(
01090             const Map_field_id  field_id,
01091             const miVector      &value) = 0;
01092 
01098         virtual Map_status set(
01099             const Map_field_id  field_id,
01100             const miColor       &value) = 0;
01101 
01108         virtual Map_status set(
01109             const Map_field_id  field_id,
01110             const miMatrix      *value) = 0;
01111 
01117         virtual Map_status set(
01118             const Map_field_id  field_id,
01119             const float         *value) = 0;
01120 
01126         virtual Map_status set(
01127             const Map_field_id  field_id,
01128             const int           *value) = 0;
01129 };
01130 
01132 class Edit_map_iterator;
01133 
01138 class Access_map_iterator {
01139 public:
01143     Access_map_iterator(
01144         const Access_map &map,
01145         Map_status *status = 0);
01146 
01150     Access_map_iterator(
01151         const Edit_map &map,
01152         Map_status *status = 0);
01153 
01157     Access_map_iterator(
01158         const Access_map_iterator &other,
01159         Map_status *status = 0);
01160 
01164     Access_map_iterator(
01165         const Edit_map_iterator &other,
01166         Map_status *status = 0);
01167 
01169     ~Access_map_iterator();
01170 
01173     Access_map_iterator & operator=(
01174         const Access_map_iterator &other);
01175 
01178     Access_map_iterator & operator=(
01179         const Edit_map_iterator &other);
01180 
01183     const Map_iterator_base * operator->();
01184 
01185 private:
01186     Map_iterator_base *m_map_iterator;
01187 };
01188 
01192 typedef Access_map_iterator Map_iterator_access;
01193 
01198 class Edit_map_iterator {
01199 public:
01203     Edit_map_iterator(
01204         const Edit_map &map,
01205         Map_status *status = 0);
01206 
01210     Edit_map_iterator(
01211         const Edit_map_iterator &other,
01212         Map_status *status = 0);
01213 
01215     ~Edit_map_iterator();
01216 
01219     Edit_map_iterator & operator=(
01220         const Edit_map_iterator &other);
01221 
01224     Map_iterator_base * operator->();
01225 
01228     const Map_iterator_base * operator->() const;
01229 
01230 private:
01231     Map_iterator_base *m_map_iterator;
01232 };
01233 
01237 typedef Edit_map_iterator Map_iterator_edit;
01238 
01244 class Map_distance_base {
01245 public:
01248     virtual const miUint get_dimension() const = 0;
01249 
01252     virtual const float *get_point() const = 0;
01253 
01258     virtual float operator() (
01259         const float *min,
01260         const float *max) const = 0;
01261 
01265     virtual float operator() (
01266         const Map_iterator_base *element) const = 0;
01267 };
01268 
01269 
01277 template<miUint DIM>
01278 class Map_distance : public mi::shader_v3::Map_distance_base {
01279 public:
01281     static const miUint DIMENSION = DIM;
01282 
01284     Map_distance()
01285     {}
01286 
01289     Map_distance(
01290         const float *point)
01291     {
01292         for (miUint i = 0; i < DIMENSION; ++i)
01293             m_point[i] = point[i];
01294     }
01295 
01298     const miUint get_dimension() const { return DIMENSION; }
01299 
01302     const float *get_point() const { return m_point; }
01303 
01308     float operator() (
01309         const float *min,
01310         const float *max) const
01311     {
01312         float d = 0.0f;
01313         float da, db, max_da_db, tmp;
01314 
01315         for (miUint i = 0; i < DIMENSION; ++i) {
01316             da = min[i] - m_point[i];
01317             db = m_point[i] - max[i];
01318 
01319             max_da_db = da > db ? da : db;
01320             tmp = max_da_db > 0.0f ? max_da_db : 0.0f;
01321 
01322             d += tmp * tmp;
01323         }
01324 
01325         return d;
01326     }
01327 
01331     virtual float operator() (
01332         const Map_iterator_base *element) const = 0;
01333 
01334 protected:
01336     float m_point[DIM];
01337 };
01338 
01345 template<miUint DIM>
01346 class Map_quad_distance : public mi::shader_v3::Map_distance<DIM> {
01347     typedef mi::shader_v3::Map_distance<DIM> base_type;
01348 public:
01351     Map_quad_distance(
01352         const float *point)
01353         : base_type(point)
01354     {}
01355 
01359     float operator() (
01360         const Map_iterator_base *element) const
01361     {
01362         float d = 0.0f;
01363         float diff;
01364         float position[DIM];
01365 
01366         element->get_position(position);
01367 
01368         for (miUint i = 0; i < DIM; ++i) {
01369             diff = this->m_point[i] - position[i];
01370             d += diff * diff;
01371         }
01372 
01373         return d;
01374     }
01375 };
01376 
01379 typedef Map_quad_distance<3> Map_quad_distance3;
01380 
01384 struct Map_lookup_entry {
01386     miUint  index;
01387 
01389     float   distance;
01390 };
01391 
01419 class Map_lookup_base {
01420     public:
01422         virtual void release() const = 0;
01423 
01426         virtual miUint size() const = 0;
01427 
01430         virtual bool is_empty() const = 0;
01431 
01434         virtual Map_status reset() = 0;
01435 
01438         virtual Map_status next() = 0;
01439 
01443         virtual bool at_end(
01444             Map_status  *status = 0) const = 0;
01445 
01448         virtual Map_status sort() = 0;
01449 
01452         virtual Map_status sort_descending() = 0;
01453 
01458         virtual Map_lookup_entry get(
01459             const miUint    n,
01460             Map_status      *status = 0) const = 0;
01461 
01465         virtual Map_lookup_entry get(
01466             Map_status  *status = 0) const = 0;
01467 
01471         virtual miUint get_index(
01472             Map_status  *status = 0) const = 0;
01473 
01477         virtual float get_distance(
01478             Map_status  *status = 0) const = 0;
01479 
01483         virtual Map_status get(
01484             Map_element &element) const = 0;
01485 
01489         virtual Map_status get_position(
01490             float       *position) const = 0;
01491 
01495         virtual Map_status get_position(
01496             miVector    &position) const = 0;
01497 
01503         virtual Map_status get(
01504             const Map_field_id  field_id,
01505             float               &value) const = 0;
01506 
01512         virtual Map_status get(
01513             const Map_field_id  field_id,
01514             int                 &value) const = 0;
01515 
01521         virtual Map_status get(
01522             const Map_field_id  field_id,
01523             miVector            &value) const = 0;
01524 
01530         virtual Map_status get(
01531             const Map_field_id  field_id,
01532             miColor             &value) const = 0;
01533 
01540         virtual Map_status get(
01541             const Map_field_id  field_id,
01542             miMatrix            *value) const = 0;
01543 
01549         virtual Map_status get(
01550             const Map_field_id  field_id,
01551             float               *value) const = 0;
01552 
01558         virtual Map_status get(
01559             const Map_field_id  field_id,
01560             int                 *value) const = 0;
01561 
01568         virtual Map_status search(
01569             const Map_distance_base &distance_functor,
01570             const miUint        max_elements = 1,
01571             const float         max_search_dist = miHUGE_SCALAR) = 0;
01572 
01581         virtual Map_status search(
01582             const miVector      &point,
01583             const miUint        max_elements = 1,
01584             const float         max_search_dist = miHUGE_SCALAR) = 0;
01585 };
01586 
01591 class Map_lookup {
01592 public:
01596     Map_lookup(
01597         const Access_map &map,
01598         Map_status *status = 0);
01599 
01603     Map_lookup(
01604         const Map_lookup &other,
01605         Map_status *status = 0);
01606 
01608     ~Map_lookup();
01609 
01612     Map_lookup & operator=(
01613         const Map_lookup &other);
01614 
01617     Map_lookup_base * operator->();
01618 
01619 private:
01620     Map_lookup_base* m_map_lookup;
01621 };
01622 
01625 inline Access_map::Access_map(
01626     const miTag tag)
01627     : m_map_h(0)
01628 {
01629     m_map_h = Access_interface()->accessMap(tag);
01630 }
01631 
01632 inline Access_map::Access_map(
01633     const char *filename,
01634     Map_status *status)
01635     : m_map_h(0)
01636 {
01637     m_map_h = Access_interface()->accessMap(filename, status);
01638 }
01639 
01640 inline Access_map::~Access_map()
01641 {
01642     if(m_map_h != 0)
01643         m_map_h->release();
01644 }
01645 
01646 inline const Map_base * Access_map::operator->()
01647 {
01648     if(m_map_h != 0){
01649         return (*m_map_h).operator->();
01650     }
01651     return 0;
01652 }
01653 
01654 inline const Map_base * Access_map::operator->() const
01655 {
01656     if(m_map_h != 0){
01657         return (*m_map_h).operator->();
01658     }
01659     return 0;
01660 }
01661 
01662 inline miTag Access_map::get_tag() const
01663 {
01664     if(m_map_h != 0){
01665         return m_map_h->get_tag();
01666     }
01667     return 0;
01668 }
01669 
01670 inline miTag Access_map::store()
01671 {
01672     if(m_map_h != 0){
01673         return m_map_h->store();
01674     }
01675     return 0;
01676 }
01677 
01680 inline Edit_map::Edit_map(
01681     const Map_declaration &map_declaration)
01682     : m_map_h(0)
01683 {
01684     m_map_h = Access_interface()->createMap(map_declaration.operator->());
01685 }
01686 
01687 inline Edit_map::Edit_map()
01688     : m_map_h(0)
01689 {
01690     m_map_h = Access_interface()->createMap();
01691 }
01692 
01693 inline Edit_map::Edit_map(
01694     const miTag tag)
01695     : m_map_h(0)
01696 {
01697     m_map_h = Access_interface()->editMap(tag);
01698 }
01699 
01700 inline Edit_map::Edit_map(
01701     const char *filename,
01702     Map_status *status)
01703     : m_map_h(0)
01704 {
01705     m_map_h = Access_interface()->editMap(filename, status);
01706 }
01707 
01708 inline Edit_map::~Edit_map()
01709 {
01710     if(m_map_h != 0)
01711         m_map_h->release();
01712 }
01713 
01714 inline Map_base * Edit_map::operator->()
01715 {
01716     if(m_map_h != 0){
01717         return (*m_map_h).operator->();
01718     }
01719     return 0;
01720 }
01721 
01722 inline const Map_base * Edit_map::operator->() const
01723 {
01724     if(m_map_h != 0){
01725         return (*m_map_h).operator->();
01726     }
01727     return 0;
01728 }
01729 
01730 inline miTag Edit_map::get_tag() const
01731 {
01732     if(m_map_h != 0){
01733         return m_map_h->get_tag();
01734     }
01735     return 0;
01736 }
01737 
01738 inline miTag Edit_map::store()
01739 {
01740     if(m_map_h != 0){
01741         return m_map_h->store();
01742     }
01743     return 0;
01744 }
01745 
01748 inline Map_declaration::Map_declaration(
01749     miUint dimension)
01750     : m_map_declaration(0)
01751 {
01752     m_map_declaration = Access_interface()->createMapDeclaration(
01753         dimension);
01754 }
01755 
01756 inline Map_declaration::Map_declaration(
01757     const Access_map &map,
01758     Map_status *status)
01759     : m_map_declaration(0)
01760 {
01761     m_map_declaration = Access_interface()->copyMapDeclaration(
01762         map.operator->(), status);
01763 }
01764 
01765 inline Map_declaration::Map_declaration(
01766     const Edit_map &map,
01767     Map_status *status)
01768     : m_map_declaration(0)
01769 {
01770     m_map_declaration = Access_interface()->copyMapDeclaration(
01771         map.operator->(), status);
01772 }
01773 
01774 inline Map_declaration::Map_declaration(
01775     const Map_element &map_element,
01776     Map_status *status)
01777     : m_map_declaration(0)
01778 {
01779     m_map_declaration = Access_interface()->copyMapDeclaration(
01780         map_element.operator->(), status);
01781 }
01782 
01783 inline Map_declaration::Map_declaration(
01784     const Map_declaration &other,
01785     Map_status *status)
01786     : m_map_declaration(0)
01787 {
01788     m_map_declaration = Access_interface()->copyMapDeclaration(
01789         other.m_map_declaration, status);
01790 }
01791 
01792 inline Map_declaration & Map_declaration::operator=(
01793     const Map_declaration &other)
01794 {
01795     if (m_map_declaration != 0)
01796         m_map_declaration->release();
01797     m_map_declaration = Access_interface()->copyMapDeclaration(
01798         other.m_map_declaration, 0);
01799     return *this;
01800 }
01801 
01802 inline Map_declaration::~Map_declaration()
01803 {
01804     if (m_map_declaration != 0)
01805         m_map_declaration->release();
01806 }
01807 
01808 inline Map_declaration_base * Map_declaration::operator->()
01809 {
01810     return m_map_declaration;
01811 }
01812 
01813 inline const Map_declaration_base * Map_declaration::operator->() const
01814 {
01815     return m_map_declaration;
01816 }
01817 
01820 inline Map_element::Map_element()
01821     : m_map_element(0)
01822 {
01823     m_map_element = Access_interface()->createMapElement();
01824 }
01825 
01826 inline Map_element::Map_element(
01827     const Map_declaration &declaration)
01828     : m_map_element(0)
01829 {
01830     m_map_element = Access_interface()->createMapElement(
01831         declaration.operator->());
01832 }
01833 
01834 inline Map_element::Map_element(
01835     const Map_element &other)
01836     : m_map_element(0)
01837 {
01838     m_map_element = Access_interface()->copyMapElement(
01839         other.m_map_element);
01840 }
01841 
01842 inline Map_element & Map_element::operator=(
01843     const Map_element &other)
01844 {
01845     m_map_element->release();
01846     m_map_element = Access_interface()->copyMapElement(
01847         other.m_map_element);
01848     return *this;
01849 }
01850 
01851 inline Map_element::~Map_element()
01852 {
01853     m_map_element->release();
01854 }
01855 
01856 inline Map_element_base * Map_element::operator->()
01857 {
01858     return m_map_element;
01859 }
01860 
01861 inline const Map_element_base * Map_element::operator->() const
01862 {
01863     return m_map_element;
01864 }
01865 
01868 inline Access_map_iterator::Access_map_iterator(
01869     const Access_map &map,
01870     Map_status *status)
01871     : m_map_iterator(0)
01872 {
01873     m_map_iterator = Access_interface()->createMapIterator(
01874         map.operator->(), status);
01875 }
01876 
01877 inline Access_map_iterator::Access_map_iterator(
01878     const Edit_map &map,
01879     Map_status *status)
01880     : m_map_iterator(0)
01881 {
01882     m_map_iterator = Access_interface()->createMapIterator(
01883         map.operator->(), status);
01884 }
01885 
01886 inline Access_map_iterator::Access_map_iterator(
01887     const Access_map_iterator &other,
01888     Map_status *status)
01889     : m_map_iterator(0)
01890 {
01891     m_map_iterator = Access_interface()->copyMapIterator(
01892         other.m_map_iterator, status);
01893 }
01894 
01895 inline Access_map_iterator::Access_map_iterator(
01896     const Edit_map_iterator &other,
01897     Map_status *status)
01898     : m_map_iterator(0)
01899 {
01900     m_map_iterator = Access_interface()->copyMapIterator(
01901         other.operator->(), status);
01902 }
01903 
01904 inline Access_map_iterator & Access_map_iterator::operator =(
01905     const Access_map_iterator &other)
01906 {
01907     m_map_iterator->release();
01908     m_map_iterator = Access_interface()->copyMapIterator(
01909         other.m_map_iterator, 0);
01910     return *this;
01911 }
01912 
01913 inline Access_map_iterator & Access_map_iterator::operator =(
01914     const Edit_map_iterator &other)
01915 {
01916     if (m_map_iterator != 0)
01917         m_map_iterator->release();
01918     m_map_iterator = Access_interface()->copyMapIterator(
01919         other.operator->(), 0);
01920     return *this;
01921 }
01922 
01923 inline Access_map_iterator::~Access_map_iterator()
01924 {
01925     if (m_map_iterator != 0)
01926         m_map_iterator->release();
01927 }
01928 
01929 inline const Map_iterator_base * Access_map_iterator::operator->()
01930 {
01931     return m_map_iterator;
01932 }
01933 
01936 inline Edit_map_iterator::Edit_map_iterator(
01937     const Edit_map &map,
01938     Map_status *status)
01939     : m_map_iterator(0)
01940 {
01941     m_map_iterator = Access_interface()->createMapIterator(
01942         map.operator->(), status);
01943 }
01944 
01945 inline Edit_map_iterator::Edit_map_iterator(
01946     const Edit_map_iterator &other,
01947     Map_status *status)
01948     : m_map_iterator(0)
01949 {
01950     m_map_iterator = Access_interface()->copyMapIterator(
01951         other.m_map_iterator, status);
01952 }
01953 
01954 inline Edit_map_iterator & Edit_map_iterator::operator =(
01955     const Edit_map_iterator &other)
01956 {
01957     if (m_map_iterator != 0)
01958         m_map_iterator->release();
01959     m_map_iterator = Access_interface()->copyMapIterator(
01960         other.m_map_iterator, 0);
01961     return *this;
01962 }
01963 
01964 inline Edit_map_iterator::~Edit_map_iterator()
01965 {
01966     if (m_map_iterator != 0)
01967         m_map_iterator->release();
01968 }
01969 
01970 inline Map_iterator_base * Edit_map_iterator::operator->()
01971 {
01972     return m_map_iterator;
01973 }
01974 
01975 inline const Map_iterator_base * Edit_map_iterator::operator->() const
01976 {
01977     return m_map_iterator;
01978 }
01979 
01982 inline Map_lookup::Map_lookup(
01983     const Access_map &map,
01984     Map_status *status)
01985     : m_map_lookup(0)
01986 {
01987     m_map_lookup = Access_interface()->createMapLookup(
01988         map.operator->(), status);
01989 }
01990 
01991 inline Map_lookup::Map_lookup(
01992     const Map_lookup &other,
01993     Map_status *status)
01994     : m_map_lookup(0)
01995 {
01996     m_map_lookup = Access_interface()->copyMapLookup(
01997         other.m_map_lookup, status);
01998 }
01999 
02000 inline Map_lookup::~Map_lookup()
02001 {
02002     if (m_map_lookup != 0)
02003         m_map_lookup->release();
02004 }
02005 
02006 inline Map_lookup & Map_lookup::operator = (
02007     const Map_lookup &other)
02008 {
02009     if (m_map_lookup != 0)
02010         m_map_lookup->release();
02011     m_map_lookup = Access_interface()->copyMapLookup(
02012         other.m_map_lookup, 0);
02013     return *this;
02014 }
02015 
02016 inline Map_lookup_base * Map_lookup::operator->()
02017 {
02018     return m_map_lookup;
02019 }
02020 
02021 } // namespace shader_v3
02022 } // namespace mi
02023 
02024 #endif //SHADER_MAP_H

Copyright © 1986-2009 by mental images GmbH