Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

NetDisplay.cpp

Go to the documentation of this file.
00001 /* ---------------------------------------------------------------------------
00002     Phission : 
00003         Realtime Vision Processing System
00004     
00005     Copyright (C) 2003-2006 Philip D.S. Thoren (pthoren@cs.uml.edu)
00006     University of Massachusetts at Lowell,
00007     Laboratory for Artificial Intelligence and Robotics
00008     
00009     This file is part of Phission.
00010 
00011     Phission is free software; you can redistribute it and/or modify
00012     it under the terms of the GNU Lesser General Public License as published by
00013     the Free Software Foundation; either version 2 of the License, or
00014     (at your option) any later version.
00015 
00016     Phission is distributed in the hope that it will be useful,
00017     but WITHOUT ANY WARRANTY; without even the implied warranty of
00018     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019     GNU Lesser General Public License for more details.
00020 
00021     You should have received a copy of the GNU Lesser General Public License
00022     along with Phission; if not, write to the Free Software
00023     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024 
00025  ---------------------------------------------------------------------------*/
00026 #ifdef HAVE_CONFIG_H
00027     #include <phissionconfig.h>
00028 #endif
00029 
00030 #include <phStandard.h>
00031 
00032 #include <phNetImageWindow.h>
00033 #include <NetDisplay.h>
00034 
00035 #include <phError.h>
00036 #include <phMemory.h>
00037 #include <phPrint.h>
00038 
00039 /* ---------------------------------------------------------------------- */
00040 NetDisplay::NetDisplay(uint32_t width, uint32_t height, char *title ) : 
00041                 phDisplayInterface(width,height,title)
00042 {
00043     phFUNCTION("NetDisplay::NetDisplay()")
00044 
00045     rc = this->lock();
00046     phPRINT_RC(rc,NULL,"this->lock()");
00047    
00048     this->setName("NetDisplay");
00049 
00050     /* Create the X11 Window that will be used to display the images 
00051      * on a system that supports X11: Linux or Cygwin w/X.org packages*/
00052     if (this->m_imageWindow == NULL)
00053     {
00054         if (title == NULL)
00055         {
00056             title = "Phission: NetDisplay";
00057         }
00058  
00059         this->m_imageWindow = new phNetImageWindow(0,0, width, height, title);
00060         phPRINT_NULLPTR(this->m_imageWindow,"new", "new phNetImageWindow failed.");
00061     }
00062 
00063     rc = this->unlock();
00064     phPRINT_RC(rc,NULL,"this->unlock()");
00065 }
00066 
00067 /* ---------------------------------------------------------------------- */
00068 int NetDisplay::setPort( uint32_t portNum )
00069 {
00070     phFUNCTION("NetDisplay::setPort")
00071     int retrc = phSUCCESS;
00072 
00073     rc = this->lock();
00074     phPRINT_RC(rc,NULL,"this->lock()");
00075 
00076     if (this->m_imageWindow != NULL)
00077     {
00078         phNetImageWindow *niw = (phNetImageWindow *)this->m_imageWindow;
00079         retrc = rc = niw->setPort(portNum);
00080         phPRINT_RC(rc,NULL,"niw->setPort(portNum:%u)",portNum);
00081     }
00082     else
00083     {
00084         retrc = phFAIL;
00085     }
00086     
00087     rc = this->unlock();
00088     phPRINT_RC(rc,NULL,"this->unlock()");
00089 
00090     return retrc;
00091 }
00092 
00093 /* ---------------------------------------------------------------------- */
00094 uint32_t NetDisplay::getPort( )
00095 {
00096     phFUNCTION("NetDisplay::getPort")
00097     uint32_t returnval = 0;
00098 
00099     rc = this->lock();
00100     phPRINT_RC(rc,NULL,"this->lock()");
00101 
00102     if (this->m_imageWindow != NULL)
00103     {
00104         phNetImageWindow *niw = (phNetImageWindow *)this->m_imageWindow;
00105         returnval = niw->getPort();
00106     }
00107     
00108     rc = this->unlock();
00109     phPRINT_RC(rc,NULL,"this->unlock()");
00110 
00111     return returnval;
00112 }
00113 
00114 /* ---------------------------------------------------------------------- */
00115 int NetDisplay::setFormat( uint32_t format )
00116 {
00117     phFUNCTION("NetDisplay::setFormat")
00118     int retrc = phSUCCESS;
00119     
00120     rc = this->lock();
00121     phPRINT_RC(rc,NULL,"this->lock()");
00122 
00123     if (this->m_imageWindow != NULL)
00124     {
00125         retrc = rc = this->m_imageWindow->setFormats(format);
00126         phPRINT_RC(rc,NULL,"m_imageWindow->setFormat(format:%u)",format);
00127     }
00128     else
00129     {
00130         retrc = phFAIL;
00131     }
00132 
00133     rc = this->unlock();
00134     phPRINT_RC(rc,NULL,"this->unlock()");
00135 
00136     return retrc;
00137 }
00138 
00139 /* ---------------------------------------------------------------------- */
00140 uint32_t NetDisplay::getFormat( )
00141 {
00142     phFUNCTION("NetDisplay::getFormat")
00143     uint32_t returnval = 0;
00144 
00145     rc = this->lock();
00146     phPRINT_RC(rc,NULL,"this->lock()");
00147 
00148     if (this->m_imageWindow != NULL)
00149     {
00150         returnval = this->m_imageWindow->getFormats();
00151     }
00152     
00153     rc = this->unlock();
00154     phPRINT_RC(rc,NULL,"this->unlock()");
00155 
00156     return returnval;
00157 }
00158 
00159 




Copyright (C) 2002 - 2007 Philip D.S. Thoren ( pthoren@users.sourceforge.net )
University Of Massachusetts at Lowell
Robotics Lab
SourceForge.net Logo

Generated on Sat Jun 16 02:44:03 2007 for phission by  doxygen 1.4.4