casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
DisplayDataHolder.h
Go to the documentation of this file.
00001 //# Copyright (C) 2005
00002 //# Associated Universities, Inc. Washington DC, USA.
00003 //#
00004 //# This library is free software; you can redistribute it and/or modify it
00005 //# under the terms of the GNU Library General Public License as published by
00006 //# the Free Software Foundation; either version 2 of the License, or (at your
00007 //# option) any later version.
00008 //#
00009 //# This library is distributed in the hope that it will be useful, but WITHOUT
00010 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00011 //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
00012 //# License for more details.
00013 //#
00014 //# You should have received a copy of the GNU Library General Public License
00015 //# along with this library; if not, write to the Free Software Foundation,
00016 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
00017 //#
00018 //# Correspondence concerning AIPS++ should be addressed as follows:
00019 //#        Internet email: aips2-request@nrao.edu.
00020 //#        Postal address: AIPS++ Project Office
00021 //#                        National Radio Astronomy Observatory
00022 //#                        520 Edgemont Road
00023 //#                        Charlottesville, VA 22903-2475 USA
00024 //#
00025 
00026 #ifndef DISPLAYDATAHOLDER_H_
00027 #define DISPLAYDATAHOLDER_H_
00028 
00029 #include <list>
00030 namespace casa {
00031 
00032 class QtDisplayData;
00033 class ImageTracker;
00034 class ImageDisplayer;
00035 
00040 class DisplayDataHolder {
00041 public:
00042         DisplayDataHolder();
00043 
00044         //Adds the DisplayData.
00045         void addDD( QtDisplayData* dd, int position = -1 );
00046 
00047         // Removes the QDD from the list and deletes it (if it existed --
00048         // Return value: whether qdd was in the list in the first place).
00049         bool removeDD(QtDisplayData* qdd, bool signal = true);
00050         void removeDDAll();
00051 
00052         // Insert and discard to basically the same thing as add/remove
00053         // except that they perform the operation through a GUI level
00054         // if one is available.
00055         void insertDD( QtDisplayData* dd, int position );
00056         void discardDD( QtDisplayData* dd, bool signal );
00057 
00058         //Iteration support
00059         typedef std::list<QtDisplayData *> DisplayDataList;
00060         typedef DisplayDataList::const_iterator DisplayDataIterator;
00061         int getCount() const;
00062         bool isEmpty() const;
00063         DisplayDataIterator beginDD () const;
00064         DisplayDataIterator endDD () const;
00065 
00066         //Controlling DD
00067         QtDisplayData* getDDControlling( ) const;
00068         void setDDControlling( QtDisplayData* controllingDD );
00069 
00070         // retrieve a DD with given name (0 if none).
00071         QtDisplayData* getDD(const std::string& name) const;
00072 
00073         // Check that a given DD is on the list.
00074         bool exists(QtDisplayData* qdd) const;
00075 
00076         void setImageTracker( ImageTracker* tracker );
00077         void setImageDisplayer( ImageDisplayer* displayer );
00078         virtual ~DisplayDataHolder();
00079 private:
00080         DisplayDataHolder( const DisplayDataHolder& displayDataHolder );
00081         DisplayDataHolder operator=( const DisplayDataHolder& displayDataHolder );
00082         ImageTracker* imageTracker;
00083         ImageDisplayer* imageDisplayer;
00084         QtDisplayData *controlling_dd;
00085         std::list<QtDisplayData*> dataList;
00086 };
00087 
00088 } /* namespace casa */
00089 #endif /* DISPLAYDATAHOLDER_H_ */