zone.h

Go to the documentation of this file.
00001 /*
00002  * zone.h
00003  *
00004  * Copyright (C) 2007-2009  Thomas A. Vaughan
00005  * All rights reserved.
00006  *
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted provided that the following conditions are met:
00010  *     * Redistributions of source code must retain the above copyright
00011  *       notice, this list of conditions and the following disclaimer.
00012  *     * Redistributions in binary form must reproduce the above copyright
00013  *       notice, this list of conditions and the following disclaimer in the
00014  *       documentation and/or other materials provided with the distribution.
00015  *     * Neither the name of the <organization> nor the
00016  *       names of its contributors may be used to endorse or promote products
00017  *       derived from this software without specific prior written permission.
00018  *
00019  * THIS SOFTWARE IS PROVIDED BY THOMAS A. VAUGHAN ''AS IS'' AND ANY
00020  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
00021  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00022  * DISCLAIMED. IN NO EVENT SHALL THOMAS A. VAUGHAN BE LIABLE FOR ANY
00023  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
00024  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
00025  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
00026  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
00027  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
00028  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00029  *
00030  *
00031  * Declaration of the basic Zone interfaces.  Anyone that wants to construct
00032  * aesop maps had better understand how these work.
00033  */
00034 
00035 #ifndef AESOP_INTERFACE_ZONE_H__
00036 #define AESOP_INTERFACE_ZONE_H__
00037 
00038 // includes --------------------------------------------------------------------
00039 #include "typeinst/typeinst.h"
00040 
00041 
00042 namespace aesop {
00043 
00044 
00045 // forward declarations
00046 class LeafZone;
00047 
00049 
00052 
00053 
00054 
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 class Zone {
00071 public:
00072         // public typedefs -----------------------------------------------------
00073         enum eType {
00074                 eType_Parent            = 0x01, 
00075                 eType_Leaf              = 0x02, 
00076                 eType_VirtualLeaf       = 0x12, 
00077 
00078                 eType_Invalid           = 0x00  // keep this last
00079         };
00080 
00081         // virtual destructor --------------------------------------------------
00082         virtual ~Zone(void) throw();
00083 
00084         // aesop::Zone class interface methods ----------------------------------
00085 
00087         virtual const char * getId(void) const throw() = 0;
00088 
00090         virtual eType getType(void) const throw() = 0;
00091 
00093         virtual void getBoundingRect(OUT rect3d_t& r) const = 0;
00094 
00096         virtual bool containsPoint(IN const point3d_t& p) const throw() = 0;
00097 
00099         virtual LeafZone * getLeafZone(IN const point3d_t& p) throw() = 0;
00100 
00102         virtual const LeafZone * getLeafZone(IN const point3d_t& p) const throw() = 0;
00103 
00104         // allow getting and setting of user data (client data)
00105         virtual void * getUserPointer(void) const throw() = 0;
00106         virtual void setUserPointer(void *) throw() = 0;
00107 };
00108 
00109 
00110 
00112 
00115 
00116 typedef void (*leafzone_iteration_fn)(
00117                                 IN LeafZone * lz,
00118                                 IN void * context);
00119 
00120 
00122 
00124 
00125 
00126 
00127 
00128 
00129 
00130 
00131 
00132 
00133 
00134 
00135 
00136 
00137 
00138 
00139 
00140 
00141 
00142 
00143 
00144 
00145 
00146 
00147 
00148 
00149 
00150 
00151 
00152 
00153 
00154 
00155 
00156 
00157 
00158 
00159 
00160 
00161 class LeafZone : public Zone {
00162 public:
00163         // virtual destructor --------------------------------------------------
00164         virtual ~LeafZone(void) throw();
00165 
00166         // aesop::LeafZone class interface methods ----------------------------
00167 
00169         virtual void iterateVisibleZones(IN leafzone_iteration_fn callback,
00170                                 IN void * context) = 0;
00171 
00174         virtual bool isLeafVisible(IN LeafZone * lzRemote) throw() = 0;
00175 
00178         virtual void iterateStaticInstances(IN instance_iteration_fn callback,
00179                                 IN void * context) = 0;
00180 };
00181 
00182 
00183 
00184 };      // aesop namespace
00185 
00186 
00187 #endif  // AESOP_INTERFACE_ZONE_H__
00188