Transformation.cxx
Go to the documentation of this file.00001 /* ======================================================================== 00002 * Copyright (c) 2006, 00003 * Institute for Computer Graphics and Vision 00004 * Graz University of Technology 00005 * All rights reserved. 00006 * 00007 * Redistribution and use in source and binary forms, with or without 00008 * modification, are permitted provided that the following conditions are 00009 * met: 00010 * 00011 * Redistributions of source code must retain the above copyright notice, 00012 * this list of conditions and the following disclaimer. 00013 * 00014 * Redistributions in binary form must reproduce the above copyright 00015 * notice, this list of conditions and the following disclaimer in the 00016 * documentation and/or other materials provided with the distribution. 00017 * 00018 * Neither the name of the Graz University of Technology nor the names of 00019 * its contributors may be used to endorse or promote products derived from 00020 * this software without specific prior written permission. 00021 * 00022 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS 00023 * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 00024 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 00025 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER 00026 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 00027 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 00028 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 00029 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF 00030 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 00031 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00032 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00033 * ======================================================================== 00034 * PROJECT: OpenTracker 00035 * ======================================================================== */ 00042 /* ======================================================================= */ 00043 00044 // this will remove the warning 4786 00045 #include "../tool/disable4786.h" 00046 00047 #include "Transformation.h" 00048 00049 namespace ot { 00050 00051 // constructor method. 00052 00053 Transformation::Transformation() 00054 : Node() 00055 , localEvent() 00056 { 00057 } 00058 00059 // returns the event number n back in time starting with the newest for n = 0 00060 00061 Event& Transformation::getEvent(unsigned int number) 00062 { 00063 Node * child = getChild( 0 ); 00064 if( child != NULL ) 00065 { 00066 if( child->isEventQueue() == 1 ) 00067 { 00068 return *transformEvent( & child->getEvent( number )); 00069 } 00070 } 00071 return Event::null; 00072 } 00073 00074 // returns the event closes to the given point in time 00075 00076 Event& Transformation::getEventNearTime(double time) 00077 { 00078 Node * child = getChild( 0 ); 00079 if( child != NULL ) 00080 { 00081 if( child->isEventQueue() == 1 ) 00082 { 00083 return *transformEvent( & child->getEventNearTime( time )); 00084 } 00085 } 00086 return Event::null; 00087 } 00088 00089 // returns the size of the queue 00090 00091 unsigned int Transformation::getSize() 00092 { 00093 Node * child = getChild( 0 ); 00094 if( child != NULL ) 00095 { 00096 if( child->isEventQueue() == 1 ) 00097 { 00098 return child->getSize(); 00099 } 00100 } 00101 return 0; 00102 } 00103 00104 // the function evaluation method 00105 00106 Event& Transformation::getEventAtTime(double time) 00107 { 00108 Node * child = getChild( 0 ); 00109 if( child != NULL ) 00110 { 00111 if( child->isTimeDependend() == 1 ) 00112 { 00113 return *transformEvent(& child->getEventAtTime( time )); 00114 } 00115 } 00116 return Event::null; 00117 } 00118 00119 // tests for EventGenerator interface being present. 00120 00121 int Transformation::isEventGenerator() 00122 { 00123 Node * child = getChild( 0 ); 00124 if( child != NULL ) 00125 { 00126 return child->isEventGenerator(); 00127 } 00128 return 0; 00129 } 00130 00131 // tests for EventQueue interface being present. 00132 00133 int Transformation::isEventQueue() 00134 { 00135 Node * child = getChild( 0 ); 00136 if( child != NULL ) 00137 { 00138 return child->isEventQueue(); 00139 } 00140 return 0; 00141 } 00142 00143 // tests for TimeDependend interface being present. 00144 00145 int Transformation::isTimeDependend() 00146 { 00147 Node * child = getChild( 0 ); 00148 if( child != NULL ) 00149 { 00150 return child->isTimeDependend(); 00151 } 00152 return 0; 00153 } 00154 00155 // this method is called by the EventGenerator to update it's observers. 00156 00157 void Transformation::onEventGenerated( Event& event, Node& generator) 00158 { 00159 updateObservers( *transformEvent( &event )); 00160 } 00161 00162 } // namespace ot 00163 00164 00165 /* 00166 * ------------------------------------------------------------ 00167 * End of Transformation.cxx 00168 * ------------------------------------------------------------ 00169 * Automatic Emacs configuration follows. 00170 * Local Variables: 00171 * mode:c++ 00172 * c-basic-offset: 4 00173 * eval: (c-set-offset 'substatement-open 0) 00174 * eval: (c-set-offset 'case-label '+) 00175 * eval: (c-set-offset 'statement 'c-lineup-runin-statements) 00176 * eval: (setq indent-tabs-mode nil) 00177 * End: 00178 * ------------------------------------------------------------ 00179 */