Horus Doc || C++ Reference || Class Overview   Pixels   Images   Detector   Geometry   Registry || Doxygen's quick Index  

VxFrmFtorCutList.h

00001 /*
00002  *
00003  *  Copyright (c) 2001, TNO TPD, The Netherlands.
00004  *  All rights reserved. No part of this software may be handed to or used by persons 
00005  *  or organisation outside Kenniscentrum Watergraafsmeer (UvA-ISIS, TNO TPD) without 
00006  *  the written permission of TNO TPD.
00007  *
00008  *  Author(s):
00009  *      Jan Baan (baan@tpd.tno.nl)
00010  *      Jeroen Vendrig
00011  *
00012  * 
00013  */
00014 
00015 #ifndef VxFrmFtorCutList_h
00016 #define VxFrmFtorCutList_h
00017 
00018 #include "VxFrmFtorBfo.h"
00019 #include "HxClassName.h"
00020 #include "VxSegmentList.h"
00021 
00022 template<class T>
00023 class VxFrmFtorCutList : public VxFrmFtorBfo {
00024 public:
00025     VxFrmFtorCutList(){
00026         _data = new VxFrmFtorCutListRep();
00027         _data->beginFrame = 0;
00028     }
00029 
00030     ~VxFrmFtorCutList();
00031     
00032     virtual VxValue doIt(int frame, const VxValue& input1, const VxValue& input2) {
00033         if (input1.isNull() || input2.isNull())
00034             return VxValue();
00035         
00036         T val1, val2;
00037         input1.get(val1);
00038         input2.get(val2);
00039         
00040         _data->lastFrame = frame-1;
00041 
00042         if((val1!=0) || ((val2!=0) && ((frame - _data->beginFrame)>5))) {
00043             VxSegment seg(_data->beginFrame,frame-2);
00044             _data->CutList.push_back(seg);
00045             _data->beginFrame = frame-1;
00046         } 
00047         //else if(val2!=0) {
00048         //  if((frame-_data->beginFrame)>10) {
00049         //      VxSegment seg(_data->beginFrame,frame-2);
00050         //      _data->CutList.push_back(seg);
00051         //      _data->beginFrame = frame-1;                
00052         //  }
00053         //}
00054 
00055         return VxValue((int) 0);
00056     };
00057         
00058     virtual HxString    getInputClass1() const {
00059         return HxClassName<T>(); 
00060     }
00061 
00062     virtual HxString    getInputClass2() const {
00063         return HxClassName<T>();
00064     }
00065 
00066     virtual HxString    getOutputClass() const {
00067         return HxString("int");
00068     }
00069 
00070     virtual HxString    name() const {
00071         return HxString("CutList");
00072     }
00073 
00074     virtual VxFrmFtorBfo* clone() const {
00075         return new VxFrmFtorCutList(*this);
00076     }
00077 
00078     VxSegmentList       getCutList() {
00079         _data->CutList.push_back(VxSegment(_data->beginFrame,_data->lastFrame));
00080         return _data->CutList;
00081     }
00082 
00083 protected:
00084     VxFrmFtorCutList& operator=(const VxFrmFtorCutList& rhs);
00085     
00086 private:    
00087     struct VxFrmFtorCutListRep{
00088 
00089         int                     beginFrame;
00090         int                     lastFrame;
00091         
00092         VxSegmentList           CutList;
00093 
00094         int                     refCount;
00095         VxFrmFtorCutListRep()           { refCount = 1;}        
00096     };
00097     
00098     VxFrmFtorCutListRep*            _data;
00099     
00100 };
00101 
00102 template<class T>
00103 inline VxFrmFtorCutList<T>& 
00104 VxFrmFtorCutList<T>::operator=(const VxFrmFtorCutList<T>& rhs)
00105 {
00106     if (--_data->refCount<= 0 && _data != rhs._data)
00107     {
00108         std::cout << "Deleted graphbox" << std::endl;
00109         delete _data;
00110     }
00111     (_data=rhs._data)->refCount++; 
00112     return *this;
00113 }
00114 
00115 template<class T>
00116 VxFrmFtorCutList<T>::~VxFrmFtorCutList()
00117 {
00118     _data->refCount--;
00119     if (_data->refCount == 0) 
00120     {
00121         delete _data;
00122     }
00123 }
00124 
00125 
00126 #endif

Generated on Tue Feb 3 14:18:44 2004 for C++Reference by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001