Different Camera vendors driving : polymorphism

This is a discussion on Different Camera vendors driving : polymorphism within the C++ Programming forums, part of the General Programming Boards category; Code: class CameraClass { public: virtual char * GetImageFirstBytePointer(unsigned int i)=0; }; class CameraPros:public CameraClass { private : tProsFrame Frame[FRAME_NUMBER]; ...

  1. #1
    Alessio Stella
    Join Date
    May 2008
    Location
    Italy, Bologna
    Posts
    251
    Code:
    class CameraClass
    {
    public:
    	virtual char * GetImageFirstBytePointer(unsigned int i)=0;
    };
    
    class CameraPros:public CameraClass
    {
    private :
        tProsFrame       Frame[FRAME_NUMBER];  
    public:
    	char * GetImageFirstBytePointer(unsigned int i)
    	{//checks on i..
    		return( (char*)Frame[i].ImageBuffer );
    	}
    
    };
    
    
    class CameraVend2:public CameraClass
    {
    private :
       Vend2Frame       Frame[FRAME_NUMBER];  
    public:
    	char * GetImageFirstBytePointer(unsigned int i)
    	{//checks on i..
    		return( (char*)Frame[i].ImagePointer );
    	}
    };

    where of course tProsFrame and Vend2Frame are different structures of two different APIs which MUST satisfy the following

    "tProsFrame.ImageBuffer" "Vend2Frame.ImagePointer" must address two iimages of the same format (for instance BGR24 which is Pixel1Blue8bits,Pixel1Red8Bits,Pixel1Green8bits,Pi xel2Blue8bits,Pixel2Red8Bits..

    The images will be eaten by the same procedures to analyze them

    Is this quite correct??
    Last edited by mynickmynick; 08-21-2008 at 11:55 AM.

  2. #2
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,893
    Yes, this looks correct.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. camera rotation matrix
    By Vick jr in forum Game Programming
    Replies: 5
    Last Post: 05-26-2009, 08:16 AM
  2. LNK2001 ERROR!!! need help
    By lifeafterdeath in forum C++ Programming
    Replies: 7
    Last Post: 05-27-2008, 05:05 PM
  3. Problems moving the camera
    By Mavix in forum Game Programming
    Replies: 8
    Last Post: 01-30-2008, 11:52 AM
  4. RTS camera movement
    By blurrymadness in forum C++ Programming
    Replies: 0
    Last Post: 04-22-2007, 10:37 PM
  5. Camera rotation/movement in 3D world
    By tegwin in forum Game Programming
    Replies: 11
    Last Post: 01-24-2003, 12:43 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21