AVT相机arm版本SDK

This commit is contained in:
zhangpeng
2025-04-30 09:26:04 +08:00
parent 837c870f18
commit 78a1c63a95
705 changed files with 148770 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: AncillaryData.h
Description: Definition of class AVT::VmbAPI::AncillaryData.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_ANCILLARYDATA_H
#define AVT_VMBAPI_ANCILLARYDATA_H
#include <VimbaC/Include/VmbCommonTypes.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/FeatureContainer.h>
namespace AVT {
namespace VmbAPI {
class AncillaryData : public FeatureContainer
{
public:
AncillaryData( VmbFrame_t *pFrame );
~AncillaryData();
//
// Method: Open()
//
// Purpose: Opens the ancillary data to allow access to the elements of the ancillary data via feature access.
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
//
// Details: This function can only succeed if the given frame has been filled by the API.
//
IMEXPORT VmbErrorType Open();
//
// Method: Close()
//
// Purpose: Closes the ancillary data inside a frame.
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
//
// Details: After reading the ancillary data and before re-queuing the frame, ancillary data
// must be closed.
//
IMEXPORT VmbError_t Close();
//
// Method: GetBuffer()
//
// Purpose: Returns the underlying buffer
//
// Parameters: [out] VmbUchar_t*& pBuffer A pointer to the buffer
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetBuffer( VmbUchar_t* &pBuffer );
//
// Method: GetBuffer()
//
// Purpose: Returns the underlying buffer
//
// Parameters: [out] const VmbUchar_t*& pBuffer A pointer to the buffer
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetBuffer( const VmbUchar_t* &pBuffer ) const;
//
// Method: GetSize()
//
// Purpose: Returns the size of the underlying buffer
//
// Parameters: [out] VmbUint32_t& size The size of the buffer
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetSize( VmbUint32_t &size ) const;
private:
struct Impl;
Impl *m_pImpl;
// No default ctor
AncillaryData();
// No copy ctor
AncillaryData( const AncillaryData& );
// No assignment operator
AncillaryData& operator=( const AncillaryData& );
};
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,63 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: BasicLockable.h
Description: Definition of class AVT::VmbAPI::BasicLockable.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_BASICLOCKABLE
#define AVT_VMBAPI_BASICLOCKABLE
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Mutex.h>
namespace AVT {
namespace VmbAPI {
class BasicLockable
{
public:
IMEXPORT BasicLockable();
IMEXPORT BasicLockable( MutexPtr pMutex );
IMEXPORT virtual ~BasicLockable();
MutexPtr& GetMutex();
const MutexPtr& GetMutex() const;
void Lock()
{
SP_ACCESS(m_pMutex)->Lock();
}
void Unlock()
{
SP_ACCESS(m_pMutex)->Unlock();
}
private:
MutexPtr m_pMutex;
};
}} //namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,636 @@
/*=============================================================================
Copyright (C) 2012 - 2016 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Camera.h
Description: Definition of class AVT::VmbAPI::Camera.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_CAMERA_H
#define AVT_VMBAPI_CAMERA_H
#include <vector>
#include <string>
#include <VimbaC/Include/VimbaC.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/IRegisterDevice.h>
#include <VimbaCPP/Include/FeatureContainer.h>
#include <VimbaCPP/Include/Frame.h>
#include <VimbaCPP/Include/IFrameObserver.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
namespace AVT {
namespace VmbAPI {
typedef std::vector<CameraPtr> CameraPtrVector;
class Camera : public FeatureContainer, public IRegisterDevice
{
public:
//
// Method: Camera constructor
//
// Purpose: Creates an instance of class Camera
//
// Parameters:
//
// [in ] const char* pID The ID of the camera
// [in ] const char* pName The name of the camera
// [in ] const char* pModel The model name of the camera
// [in ] const char* pSerialNumber The serial number of the camera
// [in ] const char* pInterfaceID The ID of the interface the camera is connected to
// [in ] VmbInterfaceType interfaceType The type of the interface the camera is connected to
//
// Details: The ID of the camera may be, among others, one of the following: "169.254.12.13",
// "000f31000001", a plain serial number: "1234567890", or the device ID
// of the underlying transport layer.
//
IMEXPORT Camera( const char *pID,
const char *pName,
const char *pModel,
const char *pSerialNumber,
const char *pInterfaceID,
VmbInterfaceType interfaceType );
//
// Method: Camera destructor
//
// Purpose: Destroys an instance of class Camera
//
// Details: Destroying a camera implicitly closes it beforehand.
//
IMEXPORT virtual ~Camera();
//
// Method: Open()
//
// Purpose: Opens the specified camera.
//
// Parameters:
//
// [in ] VmbAccessMode_t accessMode Access mode determines the level of control you have on the camera
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorNotFound: The designated camera cannot be found
// - VmbErrorInvalidAccess: Operation is invalid with the current access mode
//
// Details: A camera may be opened in a specific access mode. This mode determines
// the level of control you have on a camera.
//
IMEXPORT virtual VmbErrorType Open( VmbAccessModeType accessMode );
//
// Method: Close()
//
// Purpose: Closes the specified camera.
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
//
// Details: Depending on the access mode this camera was opened in, events are killed,
// callbacks are unregistered, the frame queue is cleared, and camera control is released.
//
IMEXPORT virtual VmbErrorType Close();
//
// Method: GetID()
//
// Purpose: Gets the ID of a camera.
//
// Parameters: [out] std::string& cameraID The ID of the camera
//
// Returns:
// - VmbErrorSuccess: If no error
//
// This information remains static throughout the object's lifetime
//
VmbErrorType GetID( std::string &cameraID ) const;
//
// Method: GetName()
//
// Purpose: Gets the name of a camera.
//
// Parameters: [out] std::string& name The name of the camera
//
// Returns:
// - VmbErrorSuccess: If no error
//
// This information remains static throughout the object's lifetime
//
VmbErrorType GetName( std::string &name ) const;
//
// Method: GetModel()
//
// Purpose: Gets the model name of a camera.
//
// Parameters: [out] std::string& model The model name of the camera
//
// Returns:
// - VmbErrorSuccess: If no error
//
// This information remains static throughout the object's lifetime
//
VmbErrorType GetModel( std::string &model ) const;
//
// Method: GetSerialNumber()
//
// Purpose: Gets the serial number of a camera.
//
// Parameters: [out] std::string& serialNumber The serial number of the camera
//
// Returns:
// - VmbErrorSuccess: If no error
//
// This information remains static throughout the object's lifetime
//
VmbErrorType GetSerialNumber( std::string &serialNumber ) const;
//
// Method: GetInterfaceID()
//
// Purpose: Gets the interface ID of a camera.
//
// Parameters: [out] std::string& interfaceID The interface ID of the camera
//
// Returns:
// - VmbErrorSuccess: If no error
//
// This information remains static throughout the object's lifetime
//
VmbErrorType GetInterfaceID( std::string &interfaceID ) const;
//
// Method: GetInterfaceType()
//
// Purpose: Gets the type of the interface the camera is connected to. And therefore the type of the camera itself.
//
// Parameters: [out] VmbInterfaceType& interfaceType The interface type of the camera
//
// Returns:
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetInterfaceType( VmbInterfaceType &interfaceType ) const;
//
// Method: GetPermittedAccess()
//
// Purpose: Gets the access modes of a camera.
//
// Parameters: [out] VmbAccessModeType& permittedAccess The possible access modes of the camera
//
// Returns:
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetPermittedAccess( VmbAccessModeType &permittedAccess ) const;
//
// Method: ReadRegisters()
//
// Purpose: Reads one or more registers consecutively. The number of registers to read is determined by the number of provided addresses.
//
// Parameters: [in ] const Uint64Vector& addresses A list of register addresses
// [out] Uint64Vector& buffer The returned data as vector
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been read
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been read. See overload ReadRegisters( const Uint64Vector&, Uint64Vector&, VmbUint32_t& ).
//
virtual VmbErrorType ReadRegisters( const Uint64Vector &addresses, Uint64Vector &buffer ) const;
//
// Method: ReadRegisters()
//
// Purpose: Same as ReadRegisters( const Uint64Vector&, Uint64Vector& ), but returns the number of successful read operations in case of an error.
//
// Parameters: [in ] const Uint64Vector& addresses A list of register addresses
// [out] Uint64Vector& buffer The returned data as vector
// [out] VmbUint32_t& completedReads The number of successfully read registers
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been read
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been read.
//
virtual VmbErrorType ReadRegisters( const Uint64Vector &addresses, Uint64Vector &buffer, VmbUint32_t &completedReads ) const;
//
// Method: WriteRegisters()
//
// Purpose: Writes one or more registers consecutively. The number of registers to write is determined by the number of provided addresses.
//
// Parameters: [in] const Uint64Vector& addresses A list of register addresses
// [in] const Uint64Vector& buffer The data to write as vector
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been written
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been written. See overload WriteRegisters( const Uint64Vector&, const Uint64Vector&, VmbUint32_t& ).
//
virtual VmbErrorType WriteRegisters( const Uint64Vector &addresses, const Uint64Vector &buffer );
//
// Method: WriteRegisters()
//
// Purpose: Same as WriteRegisters( const Uint64Vector&, const Uint64Vector& ), but returns the number of successful write operations in case of an error.
//
// Parameters: [in ] const Uint64Vector& addresses A list of register addresses
// [in ] const Uint64Vector& buffer The data to write as vector
// [out] VmbUint32_t& completedWrites The number of successfully read registers
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been written
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been written.
//
virtual VmbErrorType WriteRegisters( const Uint64Vector &addresses, const Uint64Vector &buffer, VmbUint32_t &completedWrites );
//
// Method: ReadMemory()
//
// Purpose: Reads a block of memory. The number of bytes to read is determined by the size of the provided buffer.
//
// Parameters: [in ] const VmbUint64_t& address The address to read from
// [out] UcharVector& buffer The returned data as vector
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been read
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been read. See overload ReadMemory( const VmbUint64_t&, UcharVector&, VmbUint32_t& ).
//
virtual VmbErrorType ReadMemory( const VmbUint64_t &address, UcharVector &buffer ) const;
//
// Method: ReadMemory()
//
// Purpose: Same as ReadMemory( const Uint64Vector&, UcharVector& ), but returns the number of bytes successfully read in case of an error VmbErrorIncomplete.
//
// Parameters: [in] const VmbUint64_t& address The address to read from
// [out] UcharVector& buffer The returned data as vector
// [out] VmbUint32_t& completeReads The number of successfully read bytes
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been read
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been read.
//
virtual VmbErrorType ReadMemory( const VmbUint64_t &address, UcharVector &buffer, VmbUint32_t &completeReads ) const;
//
// Method: WriteMemory()
//
// Purpose: Writes a block of memory. The number of bytes to write is determined by the size of the provided buffer.
//
// Parameters: [in] const VmbUint64_t& address The address to write to
// [in] const UcharVector& buffer The data to write as vector
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been written
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been written. See overload WriteMemory( const VmbUint64_t&, const UcharVector&, VmbUint32_t& ).
//
virtual VmbErrorType WriteMemory( const VmbUint64_t &address, const UcharVector &buffer );
//
// Method: WriteMemory()
//
// Purpose: Same as WriteMemory( const Uint64Vector&, const UcharVector& ), but returns the number of bytes successfully written in case of an error VmbErrorIncomplete.
//
// Parameters: [in] const VmbUint64_t& address The address to write to
// [in] const UcharVector& buffer The data to write as vector
// [out] VmbUint32_t& sizeComplete The number of successfully written bytes
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been written
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been written.
//
virtual VmbErrorType WriteMemory( const VmbUint64_t &address, const UcharVector &buffer, VmbUint32_t &sizeComplete );
//
// Method: AcquireSingleImage()
//
// Purpose: Gets one image synchronously.
//
// Parameters: [out] FramePtr& pFrame The frame that gets filled
// [in ] VmbUint32_t timeout The time to wait until the frame got filled
// [in ] FrameAllocationMode allocationMode The frame allocation mode
//
// Returns:
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "pFrame" is NULL.
// - VmbErrorTimeout: Call timed out
//
IMEXPORT VmbErrorType AcquireSingleImage( FramePtr &pFrame, VmbUint32_t timeout, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
//
// Method: AcquireMultipleImages()
//
// Purpose: Gets a certain number of images synchronously.
//
// Parameters: [out] FramePtrVector& frames The frames that get filled
// [in ] VmbUint32_t timeout The time to wait until one frame got filled
// [in ] FrameAllocationMode allocationMode The frame allocation mode
//
// Details: The size of the frame vector determines the number of frames to use.
//
// Returns:
// - VmbErrorSuccess: If no error
// - VmbErrorInternalFault: Filling all the frames was not successful.
// - VmbErrorBadParameter: Vector "frames" is empty.
//
VmbErrorType AcquireMultipleImages( FramePtrVector &frames, VmbUint32_t timeout, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
//
// Method: AcquireMultipleImages()
//
// Purpose: Same as AcquireMultipleImages(FramePtrVector&, VmbUint32_t), but returns the number of frames that were filled completely.
//
// Parameters: [out] FramePtrVector& frames The frames that get filled
// [in ] VmbUint32_t timeout The time to wait until one frame got filled
// [out] VmbUint32_t& numFramesCompleted The number of frames that were filled completely
// [in ] FrameAllocationMode allocationMode The frame allocation mode
//
// Details: The size of the frame vector determines the number of frames to use.
// On return, "numFramesCompleted" holds the number of frames actually filled.
//
// Returns:
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: Vector "frames" is empty.
//
VmbErrorType AcquireMultipleImages( FramePtrVector &frames, VmbUint32_t timeout, VmbUint32_t &numFramesCompleted, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
//
// Method: StartContinuousImageAcquisition()
//
// Purpose: Starts streaming and allocates the needed frames
//
// Parameters: [in ] int bufferCount The number of frames to use
// [out] const IFrameObserverPtr& pObserver The observer to use on arrival of new frames
// [in] FrameAllocationMode allocationMode The frame allocation mode
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorDeviceNotOpen: The camera has not been opened before
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
// - VmbErrorInvalidAccess: Operation is invalid with the current access mode
//
IMEXPORT VmbErrorType StartContinuousImageAcquisition( int bufferCount, const IFrameObserverPtr &pObserver, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
//
// Method: StopContinuousImageAcquisition()
//
// Purpose: Stops streaming and deallocates the needed frames
//
IMEXPORT VmbErrorType StopContinuousImageAcquisition();
//
// Method: AnnounceFrame()
//
// Purpose: Announces a frame to the API that may be queued for frame capturing later.
//
// Parameters:
//
// [in ] const FramePtr& pFrame Shared pointer to a frame to announce
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
// - VmbErrorBadParameter: "pFrame" is NULL.
// - VmbErrorStructSize: The given struct size is not valid for this version of the API
//
// Details: Allows some preparation for frames like DMA preparation depending on the transport layer.
// The order in which the frames are announced is not taken in consideration by the API.
//
IMEXPORT VmbErrorType AnnounceFrame( const FramePtr &pFrame );
//
// Method: RevokeFrame()
//
// Purpose: Revoke a frame from the API.
//
// Parameters:
//
// [in ] const FramePtr& pFrame Shared pointer to a frame that is to be removed from the list of announced frames
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given frame pointer is not valid
// - VmbErrorBadParameter: "pFrame" is NULL.
// - VmbErrorStructSize: The given struct size is not valid for this version of the API
//
// Details: The referenced frame is removed from the pool of frames for capturing images.
//
IMEXPORT VmbErrorType RevokeFrame( const FramePtr &pFrame );
//
// Method: RevokeAllFrames()
//
// Purpose: Revoke all frames assigned to this certain camera.
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
//
IMEXPORT VmbErrorType RevokeAllFrames();
//
// Method: QueueFrame()
//
// Purpose: Queues a frame that may be filled during frame capturing.
//
// Parameters:
//
// [in ] const FramePtr& pFrame A shared pointer to a frame
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given frame is not valid
// - VmbErrorBadParameter: "pFrame" is NULL.
// - VmbErrorStructSize: The given struct size is not valid for this version of the API
// - VmbErrorInvalidCall: StopContinuousImageAcquisition is currently running in another thread
//
// Details: The given frame is put into a queue that will be filled sequentially.
// The order in which the frames are filled is determined by the order in which they are queued.
// If the frame was announced with AnnounceFrame() before, the application
// has to ensure that the frame is also revoked by calling RevokeFrame() or RevokeAll()
// when cleaning up.
//
IMEXPORT VmbErrorType QueueFrame( const FramePtr &pFrame );
//
// Method: FlushQueue()
//
// Purpose: Flushes the capture queue.
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
//
// Details: All the currently queued frames will be returned to the user, leaving no frames in the input queue.
// After this call, no frame notification will occur until frames are queued again.
//
IMEXPORT VmbErrorType FlushQueue();
//
// Method: StartCapture()
//
// Purpose: Prepare the API for incoming frames from this camera.
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
// - VmbErrorDeviceNotOpen: Camera was not opened for usage
// - VmbErrorInvalidAccess: Operation is invalid with the current access mode
//
IMEXPORT VmbErrorType StartCapture();
//
// Method: EndCapture()
//
// Purpose: Stop the API from being able to receive frames from this camera.
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
//
// Details: Consequences of VmbCaptureEnd():
// - The frame queue is flushed
// - The frame callback will not be called any more
//
IMEXPORT VmbErrorType EndCapture();
//
// Method: SaveCameraSettings()
//
// Purpose: Saves the current camera setup to an XML file
//
// Parameters:
//
// [in ] std::string pStrFileName xml file name
// [in ] VmbFeaturePersistSettings_t* pSettings pointer to settings struct
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
// - VmbErrorInternalFault: When something unexpected happens in VimbaC function
// - VmbErrorOther: Every other failure in load/save settings implementation class
//
VmbErrorType SaveCameraSettings( std::string fileName, VmbFeaturePersistSettings_t *pSettings = 0 ) const;
//
// Method: LoadCameraSettings()
//
// Purpose: Loads the current camera setup from an XML file into the camera
//
// Parameters:
//
// [in] std::string pStrFileName xml file name
// [in] VmbFeaturePersistSettings_t* pSettings pointer to settings struct
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The given handle is not valid
// - VmbErrorInternalFault: When something unexpected happens in VimbaC function
// - VmbErrorOther: Every other failure in load/save settings implementation class
//
VmbErrorType LoadCameraSettings( std::string fileName, VmbFeaturePersistSettings_t *pSettings = 0 ) const;
//
// Method: LoadSaveSettingsSetup()
//
// Purpose: Sets Load/Save settings behaviour (alternative to settings struct)
//
// Parameters:
//
// [in] VmbFeaturePersist_t persistType determines which feature shall be considered during load/save settings
// [in] VmbUint32_t maxIterations determines how many 'tries' during loading feature values shall be performed
// [in] VmbUint32_t loggingLevel determines level of detail for load/save settings logging
//
IMEXPORT void LoadSaveSettingsSetup( VmbFeaturePersist_t persistType, VmbUint32_t maxIterations, VmbUint32_t loggingLevel );
private:
// Default ctor
Camera();
// Copy ctor
Camera ( const Camera& );
// Assignment operator
Camera& operator=( const Camera& );
struct Impl;
Impl *m_pImpl;
// Array functions to pass data across DLL boundaries
IMEXPORT VmbErrorType GetID( char * const pID, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetName( char * const pName, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetModel( char * const pModelName, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetSerialNumber( char * const pSerial, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetInterfaceID( char * const pInterfaceID, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType AcquireMultipleImages( FramePtr *pFrames, VmbUint32_t size, VmbUint32_t nTimeout, VmbUint32_t *pNumFramesCompleted, FrameAllocationMode allocationMode );
IMEXPORT virtual VmbErrorType ReadRegisters( const VmbUint64_t *pAddressArray, VmbUint32_t addressSize, VmbUint64_t *pDataArray, VmbUint32_t *pCompletedReads ) const;
IMEXPORT virtual VmbErrorType WriteRegisters( const VmbUint64_t *pAddressArray, VmbUint32_t addressSize, const VmbUint64_t *pDataArray, VmbUint32_t *pCompletedWrites );
IMEXPORT virtual VmbErrorType ReadMemory( VmbUint64_t address, VmbUchar_t *pBuffer, VmbUint32_t bufferSize, VmbUint32_t *pSizeComplete ) const;
IMEXPORT virtual VmbErrorType WriteMemory( VmbUint64_t address, const VmbUchar_t *pBuffer, VmbUint32_t bufferSize, VmbUint32_t *pSizeComplete );
IMEXPORT VmbErrorType SaveCameraSettings( const char * const pStrFileName, VmbFeaturePersistSettings_t *pSettings ) const;
IMEXPORT VmbErrorType LoadCameraSettings( const char * const pStrFileName, VmbFeaturePersistSettings_t *pSettings ) const;
VmbFeaturePersist_t m_persistType;
VmbUint32_t m_maxIterations;
VmbUint32_t m_loggingLevel;
};
#include <VimbaCPP/Include/Camera.hpp>
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,317 @@
/*=============================================================================
Copyright (C) 2012 - 2016 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Camera.hpp
Description: Inline wrapper functions for class AVT::VmbAPI::Camera.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_CAMERA_HPP
#define AVT_VMBAPI_CAMERA_HPP
//
// Inline wrapper functions that allocate memory for STL objects in the application's context
// and to pass data across DLL boundaries using arrays
//
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Camera::GetID( std::string &rStrID ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetID( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type>tmpID( nLength + 1,'\0');
res = GetID( &tmpID[0], nLength );
if( VmbErrorSuccess == res)
{
rStrID = &*tmpID.begin();
}
}
catch(...)
{
res = VmbErrorResources;
}
}
else
{
rStrID.clear();
}
}
return res;
}
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Camera::GetName( std::string &rStrName ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetName( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if( 0 != nLength)
{
try
{
std::vector<std::string::value_type> tmpName( nLength + 1,'\0' );
res = GetName( &tmpName[0], nLength );
if( VmbErrorSuccess == res)
{
rStrName = &*tmpName.begin();
}
}
catch(...)
{
res = VmbErrorResources;
}
}
else
{
rStrName.clear();
}
}
return res;
}
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Camera::GetModel( std::string &rStrModel ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetModel( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if( 0 != nLength)
{
try
{
std::vector<std::string::value_type> tmpModel( nLength + 1,'\0');
res = GetModel( &tmpModel[0], nLength );
if( VmbErrorSuccess == res )
{
rStrModel = &*tmpModel.begin();
}
}
catch(...)
{
res = VmbErrorResources;
}
}
else
{
rStrModel.clear();
}
}
return res;
}
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Camera::GetSerialNumber( std::string &rStrSerial ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetSerialNumber( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpSerial( nLength + 1,'\0');
res = GetSerialNumber( &tmpSerial[0], nLength );
if( VmbErrorSuccess == res )
{
rStrSerial = &*tmpSerial.begin();
}
}
catch(...)
{
res = VmbErrorResources;
}
}
else
{
rStrSerial.clear();
}
}
return res;
}
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Camera::GetInterfaceID( std::string &rStrInterfaceID ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetInterfaceID( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpID( nLength + 1,'\0');
res = GetInterfaceID( &tmpID[0], nLength );
if( VmbErrorSuccess == res )
{
rStrInterfaceID = &*tmpID.begin();
}
}
catch(...)
{
res = VmbErrorResources;
}
}
else
{
rStrInterfaceID.clear();
}
}
return res;
}
inline VmbErrorType Camera::AcquireMultipleImages( FramePtrVector &rFrames, VmbUint32_t nTimeout, FrameAllocationMode allocationMode )
{
VmbErrorType res;
VmbUint32_t i;
res = AcquireMultipleImages( rFrames, nTimeout, i, allocationMode );
if ( rFrames.size() != i )
{
res = VmbErrorInternalFault;
}
return res;
}
inline VmbErrorType Camera::AcquireMultipleImages( FramePtrVector &rFrames, VmbUint32_t nTimeout, VmbUint32_t &rNumFramesCompleted, FrameAllocationMode allocationMode )
{
if ( true == rFrames.empty() )
{
return VmbErrorBadParameter;
}
return AcquireMultipleImages( &rFrames[0], (VmbUint32_t)rFrames.size(), nTimeout, &rNumFramesCompleted, allocationMode );
}
// HINT: Size of address determines how many registers to read. Size of data has to be large enough to hold the requested information
inline VmbErrorType Camera::ReadRegisters( const Uint64Vector &rAddresses, Uint64Vector &rBuffer ) const
{
VmbUint32_t i;
return ReadRegisters( rAddresses, rBuffer, i );
}
inline VmbErrorType Camera::ReadRegisters( const Uint64Vector &rAddresses, Uint64Vector &rBuffer, VmbUint32_t &rCompletedReads ) const
{
if ( true == rAddresses.empty()
|| true == rBuffer.empty()
|| rAddresses.size() > rBuffer.size() )
{
return VmbErrorBadParameter;
}
return ReadRegisters( &rAddresses[0], (VmbUint32_t)rAddresses.size(), &rBuffer[0], &rCompletedReads );
}
// HINT: Size of address determines how many registers to write.
inline VmbErrorType Camera::WriteRegisters( const Uint64Vector &rAddresses, const Uint64Vector &rBuffer )
{
VmbUint32_t i;
return WriteRegisters( rAddresses, rBuffer, i );
}
inline VmbErrorType Camera::WriteRegisters( const Uint64Vector &rAddresses, const Uint64Vector &rBuffer, VmbUint32_t &rCompletedWrites )
{
if ( true == rAddresses.empty()
|| true == rBuffer.empty()
|| rAddresses.size() != rBuffer.size() )
{
return VmbErrorBadParameter;
}
return WriteRegisters( &rAddresses[0], (VmbUint32_t)rAddresses.size(), &rBuffer[0], &rCompletedWrites );
}
// HINT: Size of buffer determines how many bytes to read.
inline VmbErrorType Camera::ReadMemory( const VmbUint64_t &rAddress, UcharVector &rBuffer ) const
{
VmbUint32_t i;
return ReadMemory( rAddress, rBuffer, i );
}
inline VmbErrorType Camera::ReadMemory( const VmbUint64_t &rAddress, UcharVector &rBuffer, VmbUint32_t &rCompletedReads ) const
{
if ( true == rBuffer.empty() )
{
return VmbErrorBadParameter;
}
return ReadMemory( rAddress, &rBuffer[0], (VmbUint32_t)rBuffer.size(), &rCompletedReads );
}
// HINT: Size of buffer determines how many bytes to write.
inline VmbErrorType Camera::WriteMemory( const VmbUint64_t &rAddress, const UcharVector &rBuffer )
{
VmbUint32_t i;
return WriteMemory( rAddress, rBuffer, i );
}
inline VmbErrorType Camera::WriteMemory( const VmbUint64_t &rAddress, const UcharVector &rBuffer, VmbUint32_t &rCompletedWrites )
{
if ( true == rBuffer.empty() )
{
return VmbErrorBadParameter;
}
return WriteMemory( rAddress, &rBuffer[0], (VmbUint32_t)rBuffer.size(), &rCompletedWrites );
}
inline VmbErrorType Camera::SaveCameraSettings( std::string strFileName, VmbFeaturePersistSettings_t *pSettings ) const
{
// parameter check
if( true == strFileName.empty() )
{
return VmbErrorBadParameter;
}
return SaveCameraSettings( strFileName.c_str(), pSettings );
}
inline VmbErrorType Camera::LoadCameraSettings( std::string strFileName, VmbFeaturePersistSettings_t *pSettings ) const
{
// parameter check
if( true == strFileName.empty() )
{
return VmbErrorBadParameter;
}
return LoadCameraSettings( strFileName.c_str(), pSettings );
}
#endif

View File

@@ -0,0 +1,191 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: EnumEntry.h
Description: Definition of class AVT::VmbAPI::EnumEntry.
An EnumEntry consists of
Name
DisplayName
Value
of one particular enumeration
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_ENUMENTRY_H
#define AVT_VMBAPI_ENUMENTRY_H
#include <string>
#include <VimbaC/Include/VimbaC.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
namespace AVT {
namespace VmbAPI {
class EnumEntry
{
public:
//
// Method: EnumEntry constructor
//
// Purpose: Creates an instance of class EnumEntry
//
// Parameters:
//
// [in ] const char* pName The name of the enum
// [in ] const char* pDisplayName The declarative name of the enum
// [in ] const char* pDescription The description of the enum
// [in ] const char* pTooltip A tooltip that can be used by a GUI
// [in ] const char* pSNFCNamespace The SFNC namespace of the enum
// [in ] VmbFeatureVisibility_t visibility The visibility of the enum
// [in ] VmbInt64_t value The integer value of the enum
//
EnumEntry( const char *pName,
const char *pDisplayName,
const char *pDescription,
const char *pTooltip,
const char *pSNFCNamespace,
VmbFeatureVisibility_t visibility,
VmbInt64_t value);
//
// Method: EnumEntry constructor
//
// Purpose: Creates an instance of class EnumEntry
//
IMEXPORT EnumEntry();
//
// Method: EnumEntry copy constructor
//
// Purpose: Creates a copy of class EnumEntry
//
IMEXPORT EnumEntry( const EnumEntry &other);
//
// Method: EnumEntry assignment operator
//
// Purpose: assigns EnumEntry to existing instance
//
IMEXPORT EnumEntry& operator=( const EnumEntry&o);
//
// Method: EnumEntry destructor
//
// Purpose: Destroys an instance of class EnumEntry
//
IMEXPORT virtual ~EnumEntry();
//
// Method: GetName()
//
// Purpose: Gets the name of an enumeration
//
// Parameters:
//
// [out] std::string& name The name of the enumeration
//
VmbErrorType GetName( std::string &name ) const;
//
// Method: GetDisplayName()
//
// Purpose: Gets a more declarative name of an enumeration
//
// Parameters:
//
// [out] std::string& displayName The display name of the enumeration
//
VmbErrorType GetDisplayName( std::string &displayName ) const;
//
// Method: GetDescription()
//
// Purpose: Gets the description of an enumeration
//
// Parameters:
//
// [out] std::string& description The description of the enumeration
//
VmbErrorType GetDescription( std::string &description ) const;
//
// Method: GetTooltip()
//
// Purpose: Gets a tooltip that can be used as pop up help in a GUI
//
// Parameters:
//
// [out] std::string& tooltip The tooltip as string
//
VmbErrorType GetTooltip( std::string &tooltip ) const;
//
// Method: GetValue()
//
// Purpose: Gets the integer value of an enumeration
//
// Parameters:
//
// [out] VmbInt64_t& value The integer value of the enumeration
//
IMEXPORT VmbErrorType GetValue( VmbInt64_t &value ) const;
//
// Method: GetVisibility()
//
// Purpose: Gets the visibility of an enumeration
//
// Parameters:
//
// [out] VmbFeatureVisibilityType& value The visibility of the enumeration
//
IMEXPORT VmbErrorType GetVisibility( VmbFeatureVisibilityType &value ) const;
//
// Method: GetSNFCNamespace()
//
// Purpose: Gets the standard feature naming convention namespace of the enumeration
//
// Parameters:
//
// [out] std::string& sFNCNamespace The feature's SFNC namespace
//
VmbErrorType GetSFNCNamespace( std::string &sFNCNamespace ) const;
private:
struct PrivateImpl;
PrivateImpl *m_pImpl;
// Array functions to pass data across DLL boundaries
IMEXPORT VmbErrorType GetName( char * const pName, VmbUint32_t &size ) const;
IMEXPORT VmbErrorType GetDisplayName( char * const pDisplayName, VmbUint32_t &size ) const;
IMEXPORT VmbErrorType GetTooltip( char * const pStrTooltip, VmbUint32_t &size ) const;
IMEXPORT VmbErrorType GetDescription( char * const pStrDescription, VmbUint32_t &size ) const;
IMEXPORT VmbErrorType GetSFNCNamespace( char * const pStrNamespace, VmbUint32_t &size ) const;
};
#include <VimbaCPP/Include/EnumEntry.hpp>
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,200 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: EnumEntry.hpp
Description: Inline wrapper functions for class AVT::VmbAPI::EnumEntry.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_ENUMENTRY_HPP
#define AVT_VMBAPI_ENUMENTRY_HPP
//
// Inline wrapper functions that allocate memory for STL objects in the application's context
// and to pass data across DLL boundaries using arrays
//
inline VmbErrorType EnumEntry::GetName( std::string &rStrName ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetName( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
res = GetName( &tmpName[0], nLength );
if ( VmbErrorSuccess == res )
{
rStrName = &*tmpName.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrName.clear();
}
}
return res;
}
inline VmbErrorType EnumEntry::GetDisplayName( std::string &rStrDisplayName ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetDisplayName( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
res = GetDisplayName( &tmpName[0], nLength );
if ( VmbErrorSuccess == res )
{
rStrDisplayName = &*tmpName.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrDisplayName.clear();
}
}
return res;
}
inline VmbErrorType EnumEntry::GetDescription( std::string &rStrDescription ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetDescription( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpDescription( nLength + 1, '\0' );
res = GetDescription( &tmpDescription[0], nLength );
if ( VmbErrorSuccess == res )
{
rStrDescription = &*tmpDescription.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrDescription.clear();
}
}
return res;
}
inline VmbErrorType EnumEntry::GetTooltip( std::string &rStrTooltip ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetTooltip( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpTooltip( nLength + 1, '\0' );
res = GetTooltip( &tmpTooltip[0], nLength );
if ( VmbErrorSuccess == res )
{
rStrTooltip = &*tmpTooltip.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrTooltip.clear();
}
}
return res;
}
inline VmbErrorType EnumEntry::GetSFNCNamespace( std::string &rStrNamespace ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetSFNCNamespace( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpNamespace( nLength + 1, '\0' );
res = GetSFNCNamespace( &tmpNamespace[0], nLength );
if ( VmbErrorSuccess == res )
{
rStrNamespace =&*tmpNamespace.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrNamespace.clear();
}
}
return res;
}
#endif

View File

@@ -0,0 +1,612 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Feature.h
Description: Definition of base class AVT::VmbAPI::Feature.
This class wraps every call to BaseFeature resp. its concrete
subclass. That way polymorphism is hidden away from the user.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_FEATURE_H
#define AVT_VMBAPI_FEATURE_H
#include <vector>
#include <map>
#include <VimbaC/Include/VimbaC.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/IFeatureObserver.h>
#include <VimbaCPP/Include/EnumEntry.h>
namespace AVT {
namespace VmbAPI {
class BaseFeature;
typedef std::vector<FeaturePtr> FeaturePtrVector;
typedef std::map<std::string, FeaturePtr> FeaturePtrMap;
class Feature
{
public:
Feature( const VmbFeatureInfo_t *pFeatureInfo, FeatureContainer *pFeatureContainer );
virtual ~Feature();
//
// Method: GetValue()
//
// Purpose: Queries the value of a feature of type VmbInt64
//
// Parameters:
//
// [out] VmbInt64_t& value The feature's value
//
IMEXPORT VmbErrorType GetValue( VmbInt64_t &value ) const;
//
// Method: GetValue()
//
// Purpose: Queries the value of a feature of type double
//
// Parameters:
//
// [out] double& value The feature's value
//
IMEXPORT VmbErrorType GetValue( double &value ) const;
//
// Method: GetValue()
//
// Purpose: Queries the value of a feature of type string
//
// Parameters:
//
// [out] std::string& value The feature's value
//
// Details: When an empty string is returned, its size
// indicates the maximum length
VmbErrorType GetValue( std::string &value ) const;
//
// Method: GetValue()
//
// Purpose: Queries the value of a feature of type bool
//
// Parameters:
//
// [out] bool& value The feature's value
//
IMEXPORT VmbErrorType GetValue( bool &value ) const;
//
// Method: GetValue()
//
// Purpose: Queries the value of a feature of type UcharVector
//
// Parameters:
//
// [out] UcharVector& value The feature's value
//
VmbErrorType GetValue( UcharVector &value ) const;
//
// Method: GetValue()
//
// Purpose: Queries the value of a feature of type const UcharVector
//
// Parameters:
//
// [out] UcharVector& value The feature's value
// [out] VmbUint32_t& sizeFilled The number of actually received values
//
VmbErrorType GetValue( UcharVector &value, VmbUint32_t &sizeFilled ) const;
//
// Method: GetValues()
//
// Purpose: Queries the values of a feature of type Int64Vector
//
// Parameters:
//
// [out] Int64Vector& values The feature's values
//
VmbErrorType GetValues( Int64Vector &values );
//
// Method: GetValues()
//
// Purpose: Queries the values of a feature of type StringVector
//
// Parameters:
//
// [out] StringVector& values The feature's values
//
VmbErrorType GetValues( StringVector &values );
//
// Method: GetEntry()
//
// Purpose: Queries a single enum entry of a feature of type Enumeration
//
// Parameters:
//
// [out] EnumEntry& entry An enum feature's enum entry
// [in ] const char* pEntryName The name of the enum entry
//
IMEXPORT VmbErrorType GetEntry( EnumEntry &entry, const char *pEntryName ) const;
//
// Method: GetEntries()
//
// Purpose: Queries all enum entries of a feature of type Enumeration
//
// Parameters:
//
// [out] EnumEntryVector& entries An enum feature's enum entries
//
VmbErrorType GetEntries( EnumEntryVector &entries );
//
// Method: GetRange()
//
// Purpose: Queries the range of a feature of type double
//
// Parameters:
//
// [out] double& minimum The feature's min value
// [out] double& maximum The feature's max value
//
IMEXPORT VmbErrorType GetRange( double &minimum, double &maximum ) const;
//
// Method: GetRange()
//
// Purpose: Queries the range of a feature of type VmbInt64
//
// Parameters:
//
// [out] VmbInt64_t& minimum The feature's min value
// [out] VmbInt64_t& maximum The feature's max value
//
IMEXPORT VmbErrorType GetRange( VmbInt64_t &minimum, VmbInt64_t &maximum ) const;
//
// Method: SetValue()
//
// Purpose: Sets the value of a feature of type VmbInt32
//
// Parameters:
//
// [in ] const VmbInt32_t& value The feature's value
//
IMEXPORT VmbErrorType SetValue( const VmbInt32_t &value );
//
// Method: SetValue()
//
// Purpose: Sets the value of a feature of type VmbInt64
//
// Parameters:
//
// [in ] const VmbInt64_t& value The feature's value
//
IMEXPORT VmbErrorType SetValue( const VmbInt64_t &value );
//
// Method: SetValue()
//
// Purpose: Sets the value of a feature of type double
//
// Parameters:
//
// [in ] const double& value The feature's value
//
IMEXPORT VmbErrorType SetValue( const double &value );
//
// Method: SetValue()
//
// Purpose: Sets the value of a feature of type char*
//
// Parameters:
//
// [in ] const char* pValue The feature's value
//
IMEXPORT VmbErrorType SetValue( const char *pValue );
//
// Method: SetValue()
//
// Purpose: Sets the value of a feature of type bool
//
// Parameters:
//
// [in ] bool value The feature's value
//
IMEXPORT VmbErrorType SetValue( bool value );
//
// Method: SetValue()
//
// Purpose: Sets the value of a feature of type UcharVector
//
// Parameters:
//
// [in ] const UcharVector& value The feature's value
//
VmbErrorType SetValue( const UcharVector &value );
// Method: HasIncrement()
//
// Purpose: Gets the support state increment of a feature
//
// Parameters:
//
// [out] VmbBool_t& incrementsupported The feature's increment support state
//
IMEXPORT VmbErrorType HasIncrement( VmbBool_t &incrementSupported ) const;
//
// Method: GetIncrement()
//
// Purpose: Gets the increment of a feature of type VmbInt64
//
// Parameters:
//
// [out] VmbInt64_t& increment The feature's increment
//
IMEXPORT VmbErrorType GetIncrement( VmbInt64_t &increment ) const;
// Method: GetIncrement()
//
// Purpose: Gets the increment of a feature of type double
//
// Parameters:
//
// [out] double& increment The feature's increment
//
IMEXPORT VmbErrorType GetIncrement( double &increment ) const;
//
// Method: IsValueAvailable()
//
// Purpose: Indicates whether an existing enumeration value is currently available.
// An enumeration value might not be selectable due to the camera's
// current configuration.
//
// Parameters:
//
// [in ] const char* pValue The enumeration value as string
// [out] bool& available True when the given value is available
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorInvalidValue: If the given value is not a valid enumeration value for this enum
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorInvalidAccess: Operation is invalid with the current access mode
// - VmbErrorWrongType: The feature is not an enumeration
//
IMEXPORT VmbErrorType IsValueAvailable( const char *pValue, bool &available ) const;
//
// Method: IsValueAvailable()
//
// Purpose: Indicates whether an existing enumeration value is currently available.
// An enumeration value might not be selectable due to the camera's
// current configuration.
//
// Parameters:
//
// [in ] const VmbInt64_t value The enumeration value as int
// [out] bool& available True when the given value is available
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorInvalidValue: If the given value is not a valid enumeration value for this enum
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorInvalidAccess: Operation is invalid with the current access mode
// - VmbErrorWrongType: The feature is not an enumeration
//
IMEXPORT VmbErrorType IsValueAvailable( const VmbInt64_t value, bool &available ) const;
//
// Method: RunCommand()
//
// Purpose: Executes a feature of type Command
//
IMEXPORT VmbErrorType RunCommand();
//
// Method: IsCommandDone()
//
// Purpose: Indicates whether the execution of a feature of type Command has finished
//
// Parameters:
//
// [out] bool& isDone True when execution has finished
//
IMEXPORT VmbErrorType IsCommandDone( bool &isDone ) const;
//
// Method: GetName()
//
// Purpose: Queries a feature's name
//
// Parameters:
//
// [out] std::string& name The feature's name
//
VmbErrorType GetName( std::string &name ) const;
//
// Method: GetDisplayName()
//
// Purpose: Queries a feature's display name
//
// Parameters:
//
// [out] std::string& displayName The feature's display name
//
VmbErrorType GetDisplayName( std::string &displayName ) const;
//
// Method: GetDataType()
//
// Purpose: Queries a feature's type
//
// Parameters:
//
// [out] VmbFeatureDataType& dataType The feature's type
//
IMEXPORT VmbErrorType GetDataType( VmbFeatureDataType &dataType ) const;
//
// Method: GetFlags()
//
// Purpose: Queries a feature's access status
//
// Parameters:
//
// [out] VmbFeatureFlagsType& flags The feature's access status
//
IMEXPORT VmbErrorType GetFlags( VmbFeatureFlagsType &flags ) const;
//
// Method: GetCategory()
//
// Purpose: Queries a feature's category in the feature tress
//
// Parameters:
//
// [out] std::string& category The feature's position in the feature tree
//
VmbErrorType GetCategory( std::string &category ) const;
//
// Method: GetPollingTime()
//
// Purpose: Queries a feature's polling time
//
// Parameters:
//
// [out] VmbUint32_t& pollingTime The interval to poll the feature
//
IMEXPORT VmbErrorType GetPollingTime( VmbUint32_t &pollingTime ) const;
//
// Method: GetUnit()
//
// Purpose: Queries a feature's unit
//
// Parameters:
//
// [out] std::string& unit The feature's unit
//
VmbErrorType GetUnit( std::string &unit ) const;
//
// Method: GetRepresentation()
//
// Purpose: Queries a feature's representation
//
// Parameters:
//
// [out] std::string& representation The feature's representation
//
VmbErrorType GetRepresentation( std::string &representation ) const;
//
// Method: GetVisibility()
//
// Purpose: Queries a feature's visibility
//
// Parameters:
//
// [out] VmbFeatureVisibilityType& visibility The feature's visibility
//
IMEXPORT VmbErrorType GetVisibility( VmbFeatureVisibilityType &visibility ) const;
//
// Method: GetToolTip()
//
// Purpose: Queries a feature's tool tip to display in the GUI
//
// Parameters:
//
// [out] std::string& toolTip The feature's tool tip
//
VmbErrorType GetToolTip( std::string &toolTip ) const;
//
// Method: GetDescription()
//
// Purpose: Queries a feature's description
//
// Parameters:
//
// [out] std::string& description The feature'sdescription
//
VmbErrorType GetDescription( std::string &description ) const;
//
// Method: GetSFNCNamespace()
//
// Purpose: Queries a feature's Standard Feature Naming Convention namespace
//
// Parameters:
//
// [out] std::string& sFNCNamespace The feature's SFNC namespace
//
VmbErrorType GetSFNCNamespace( std::string &sFNCNamespace ) const;
//
// Method: GetAffectedFeatures()
//
// Purpose: Queries the feature's that are dependent from the current feature
//
// Parameters:
//
// [out] FeaturePtrVector& affectedFeatures The features that get invalidated through the current feature
//
VmbErrorType GetAffectedFeatures( FeaturePtrVector &affectedFeatures );
//
// Method: GetSelectedFeatures()
//
// Purpose: Gets the features that get selected by the current feature
//
// Parameters:
//
// [out] FeaturePtrVector& selectedFeatures The selected features
//
VmbErrorType GetSelectedFeatures( FeaturePtrVector &selectedFeatures );
//
// Method: IsReadable()
//
// Purpose: Queries the read access status of a feature
//
// Parameters:
//
// [out] bool& isReadable True when feature can be read
//
IMEXPORT VmbErrorType IsReadable( bool &isReadable );
//
// Method: IsWritable()
//
// Purpose: Queries the write access status of a feature
//
// Parameters:
//
// [out] bool& isWritable True when feature can be written
//
IMEXPORT VmbErrorType IsWritable( bool &isWritable );
//
// Method: IsStreamable()
//
// Purpose: Queries whether a feature's value can be transferred as a stream
//
// Parameters:
//
// [out] bool& isStreamable True when streamable
//
IMEXPORT VmbErrorType IsStreamable( bool &isStreamable ) const;
//
// Method: RegisterObserver()
//
// Purpose: Registers an observer that notifies the application whenever a features value changes
//
// Parameters:
//
// [out] const IFeatureObserverPtr& pObserver The observer to be registered
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "pObserver" is NULL.
//
IMEXPORT VmbErrorType RegisterObserver( const IFeatureObserverPtr &pObserver );
//
// Method: UnregisterObserver()
//
// Purpose: Unregisters an observer
//
// Parameters:
//
// [out] const IFeatureObserverPtr& pObserver The observer to be unregistered
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "pObserver" is NULL.
//
IMEXPORT VmbErrorType UnregisterObserver( const IFeatureObserverPtr &pObserver );
void ResetFeatureContainer();
private:
BaseFeature *m_pImpl;
// No default ctor
Feature();
// No copy ctor
Feature( const Feature& );
// No assignment operator
Feature& operator=( const Feature& );
// Array functions to pass data across DLL boundaries
IMEXPORT VmbErrorType GetValue( char * const pValue, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetValue( VmbUchar_t *pValue, VmbUint32_t &size, VmbUint32_t &sizeFilled ) const;
IMEXPORT VmbErrorType GetValues( const char **pValues, VmbUint32_t &size );
IMEXPORT VmbErrorType GetValues( VmbInt64_t *pValues, VmbUint32_t &Size );
IMEXPORT VmbErrorType GetEntries( EnumEntry *pEnumEntries, VmbUint32_t &size );
IMEXPORT VmbErrorType SetValue( const VmbUchar_t *pValue, VmbUint32_t size );
IMEXPORT VmbErrorType GetName( char * const pName, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetDisplayName( char * const pDisplayName, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetCategory( char * const pCategory, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetUnit( char * const pUnit, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetRepresentation( char * const pRepresentation, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetToolTip( char * const pToolTip, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetDescription( char * const pDescription, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetSFNCNamespace( char * const pSFNCNamespace, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetAffectedFeatures( FeaturePtr *pAffectedFeatures, VmbUint32_t &nSize );
IMEXPORT VmbErrorType GetSelectedFeatures( FeaturePtr *pSelectedFeatures, VmbUint32_t &nSize );
};
#include <VimbaCPP/Include/Feature.hpp>
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,545 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Feature.hpp
Description: Inline wrapper functions for class AVT::VmbAPI::Feature.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_FEATURE_HPP
#define AVT_VMBAPI_FEATURE_HPP
//
// Inline wrapper functions that allocate memory for STL objects in the application's context
// and to pass data across DLL boundaries using arrays
//
inline VmbErrorType Feature::GetValues( StringVector &rValues )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetValues( (const char **)NULL, nSize );
if ( VmbErrorSuccess == res )
{
if ( 0 != nSize)
{
try
{
std::vector<const char*> data( nSize );
res = GetValues( &data[0], nSize );
if ( VmbErrorSuccess == res )
{
StringVector tmpValues( data.size() );
std::copy( data.begin(), data.end(), tmpValues.begin() );
rValues.swap( tmpValues);
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rValues.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetEntries( EnumEntryVector &rEntries )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetEntries( (EnumEntry*)NULL, nSize );
if ( VmbErrorSuccess == res )
{
if( 0 != nSize )
{
try
{
EnumEntryVector tmpEntries( nSize );
res = GetEntries( &tmpEntries[0], nSize );
if( VmbErrorSuccess == res)
{
rEntries.swap( tmpEntries );
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rEntries.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetValues( Int64Vector &rValues )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetValues( (VmbInt64_t*)NULL, nSize );
if ( VmbErrorSuccess == res )
{
if( 0 != nSize)
{
try
{
Int64Vector tmpValues( nSize );
res = GetValues( &tmpValues[0], nSize );
if( VmbErrorSuccess == res)
{
rValues.swap( tmpValues );
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rValues.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetValue( std::string &rStrValue ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetValue( (char * const)NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpValue( nLength + 1, '\0' );
res = GetValue( &tmpValue[0], nLength );
if ( VmbErrorSuccess == res )
{
rStrValue = &*tmpValue.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrValue.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetValue( UcharVector &rValue ) const
{
VmbUint32_t i;
return GetValue( rValue, i );
}
inline VmbErrorType Feature::GetValue( UcharVector &rValue, VmbUint32_t &rnSizeFilled ) const
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetValue( NULL, nSize, rnSizeFilled );
if ( VmbErrorSuccess == res )
{
if( 0 != nSize)
{
try
{
UcharVector tmpValue( nSize );
res = GetValue( &tmpValue[0], nSize, rnSizeFilled );
if( VmbErrorSuccess == res )
{
rValue.swap( tmpValue);
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rValue.clear();
}
}
return res;
}
inline VmbErrorType Feature::SetValue( const UcharVector &rValue )
{
if ( rValue.empty() )
{
return VmbErrorBadParameter;
}
return SetValue( &rValue[0], (VmbUint32_t)rValue.size() );
}
inline VmbErrorType Feature::GetName( std::string &rStrName ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetName( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
res = GetName( &tmpName[0], nLength );
if( VmbErrorSuccess == res)
{
rStrName = &*tmpName.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrName.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetDisplayName( std::string &rStrDisplayName ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetDisplayName( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpDisplayName( nLength + 1, '\0' );
res = GetDisplayName( &tmpDisplayName[0], nLength );
if( VmbErrorSuccess == res )
{
rStrDisplayName = &*tmpDisplayName.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrDisplayName.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetCategory( std::string &rStrCategory ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetCategory( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpCategory( nLength + 1, '\0' );
res = GetCategory( &tmpCategory[0], nLength );
if( VmbErrorSuccess == res )
{
rStrCategory = &*tmpCategory.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrCategory.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetUnit( std::string &rStrUnit ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetUnit( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpUnit( nLength + 1, '\0' );
res = GetUnit( &tmpUnit[0], nLength );
if( VmbErrorSuccess == res )
{
rStrUnit = &*tmpUnit.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrUnit.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetRepresentation( std::string &rStrRepresentation ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetRepresentation( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpRepresentation( nLength + 1, '\0' );
res = GetRepresentation( &tmpRepresentation[0], nLength );
if( VmbErrorSuccess == res )
{
rStrRepresentation = &*tmpRepresentation.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrRepresentation.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetToolTip( std::string &rStrToolTip ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetToolTip( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpToolTip( nLength + 1, '\0');
res = GetToolTip( &tmpToolTip[0], nLength );
if( VmbErrorSuccess == res )
{
rStrToolTip = &*tmpToolTip.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrToolTip.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetDescription( std::string &rStrDescription ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetDescription( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpDescription( nLength + 1, '\0');
res = GetDescription( &tmpDescription[0], nLength );
if( VmbErrorSuccess == res )
{
rStrDescription = &*tmpDescription.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrDescription.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetSFNCNamespace( std::string &rStrSFNCNamespace ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetSFNCNamespace( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if ( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpSFNCNamespace( nLength + 1, '\0' );
res = GetSFNCNamespace( &tmpSFNCNamespace[0], nLength );
if( VmbErrorSuccess == res )
{
rStrSFNCNamespace = &*tmpSFNCNamespace.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrSFNCNamespace.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetAffectedFeatures( FeaturePtrVector &rAffectedFeatures )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetAffectedFeatures( NULL, nSize );
if ( VmbErrorSuccess == res )
{
if( 0 != nSize)
{
try
{
FeaturePtrVector tmpAffectedFeatures( nSize );
res = GetAffectedFeatures( &tmpAffectedFeatures[0], nSize );
if( VmbErrorSuccess == res )
{
rAffectedFeatures.swap( tmpAffectedFeatures );
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rAffectedFeatures.clear();
}
}
return res;
}
inline VmbErrorType Feature::GetSelectedFeatures( FeaturePtrVector &rSelectedFeatures )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetSelectedFeatures( NULL, nSize );
if ( VmbErrorSuccess == res )
{
if( 0 != nSize )
{
try
{
FeaturePtrVector tmpSelectedFeatures( nSize );
res = GetSelectedFeatures( &tmpSelectedFeatures[0], nSize );
if( VmbErrorSuccess == res )
{
rSelectedFeatures.swap ( tmpSelectedFeatures );
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rSelectedFeatures.clear();
}
}
return res;
}
#endif

View File

@@ -0,0 +1,123 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: FeatureContainer.h
Description: Definition of class AVT::VmbAPI::FeatureContainer.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_FEATURECONTAINER_H
#define AVT_VMBAPI_FEATURECONTAINER_H
#include <VimbaC/Include/VmbCommonTypes.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/BasicLockable.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Feature.h>
namespace AVT {
namespace VmbAPI {
class FeatureContainer : public virtual BasicLockable
{
public:
//
// Method: FeatureContainer constructor
//
// Purpose: Creates an instance of class FeatureContainer
//
IMEXPORT FeatureContainer();
//
// Method: FeatureContainer destructor
//
// Purpose: Destroys an instance of class FeatureContainer
//
IMEXPORT ~FeatureContainer();
//
// Method: GetFeatureByName()
//
// Purpose: Gets one particular feature of a feature container (e.g. a camera)
//
// Parameters:
//
// [in ] const char* name The name of the feature to get
// [out] FeaturePtr& pFeature The queried feature
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorDeviceNotOpen: Base feature class (e.g. Camera) was not opened.
// - VmbErrorBadParameter: "name" is NULL.
//
IMEXPORT VmbErrorType GetFeatureByName( const char *pName, FeaturePtr &pFeature );
//
// Method: GetFeatures()
//
// Purpose: Gets all features of a feature container (e.g. a camera)
//
// Parameters:
//
// [out] FeaturePtrVector& features The container for all queried features
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "features" is empty.
//
// Details: Once queried, this information remains static throughout the object's lifetime
//
VmbErrorType GetFeatures( FeaturePtrVector &features );
VmbHandle_t GetHandle() const;
protected:
// Sets the C handle of a feature container
void SetHandle( const VmbHandle_t handle );
// Sets the C handle of a feature container to NULL
void RevokeHandle();
// Sets the back reference to feature container that each feature holds to NULL
// and resets all known features
void Reset();
private:
struct Impl;
Impl *m_pImpl;
IMEXPORT VmbErrorType GetFeatures( FeaturePtr *pFeatures, VmbUint32_t &size );
// No copy ctor
FeatureContainer( const FeatureContainer& );
// No assignment operator
FeatureContainer& operator=( const FeatureContainer& );
};
#include <VimbaCPP/Include/FeatureContainer.hpp>
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,71 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: FeatureContainer.hpp
Description: Inline wrapper functions for class
AVT::VmbAPI::FeatureContainer.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_FEATURECONTAINER_HPP
#define AVT_VMBAPI_FEATURECONTAINER_HPP
//
// Inline wrapper functions that allocate memory for STL objects in the application's context
// and to pass data across DLL boundaries using arrays
//
// HINT: Once queried this information remains static throughout the object's lifetime
inline VmbErrorType FeatureContainer::GetFeatures( FeaturePtrVector &features )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetFeatures( NULL, nSize );
if ( VmbErrorSuccess == res )
{
if( 0 != nSize)
{
try
{
FeaturePtrVector tmpFeatures( nSize );
res = GetFeatures( &tmpFeatures[0], nSize );
if( VmbErrorSuccess == res)
{
features.swap( tmpFeatures );
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
features.clear();
}
}
return res;
}
#endif

View File

@@ -0,0 +1,60 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: FileLogger.h
Description: Definition of class AVT::VmbAPI::FileLogger.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_FILELOGGER_H
#define AVT_VMBAPI_FILELOGGER_H
#include <string>
#include <stdio.h>
#include <fstream>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Mutex.h>
namespace AVT {
namespace VmbAPI {
class FileLogger
{
public:
FileLogger( const char *pFileName, bool append = true );
virtual ~FileLogger();
void Log( const std::string &StrMessage );
private:
std::ofstream m_File;
MutexPtr m_pMutex;
std::string GetTempPath();
FileLogger( const FileLogger& );
FileLogger& operator=( const FileLogger& );
};
}} //namespace AVT:VmbAPI
#endif

View File

@@ -0,0 +1,342 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Frame.h
Description: Definition of class AVT::VmbAPI::Frame.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_FRAME_H
#define AVT_VMBAPI_FRAME_H
#include <VimbaC/Include/VimbaC.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/IFrameObserver.h>
#include <VimbaCPP/Include/AncillaryData.h>
#include <vector>
namespace AVT {
namespace VmbAPI {
class Camera; // forward declaration of camera class for befriending
class Frame
{
friend class Camera;
public:
//
// Method: Frame constructor
//
// Purpose: Creates an instance of class Frame of a certain size
//
// Parameters: [in ] VmbInt64_t bufferSize The size of the underlying buffer
// Parameters: [in ] FrameAllocationMode allocationMode Indicates if announce frame or alloc and announce frame is used
//
IMEXPORT explicit Frame( VmbInt64_t bufferSize, FrameAllocationMode allocationMode = FrameAllocation_AnnounceFrame );
//
// Method: Frame constructor
//
// Purpose: Creates an instance of class Frame with the given user buffer of the given size
//
// Parameters: [in ] VmbUchar_t* pBuffer A pointer to an allocated buffer
// Parameters: [in ] VmbInt64_t bufferSize The size of the underlying buffer
//
IMEXPORT Frame( VmbUchar_t *pBuffer, VmbInt64_t bufferSize );
//
// Method: Frame destructor
//
// Purpose: Destroys an instance of class Frame
//
IMEXPORT ~Frame();
//
// Method: RegisterObserver()
//
// Purpose: Registers an observer that will be called whenever a new frame arrives
//
// Parameters: [in ] const IFrameObserverPtr& pObserver An object that implements the IObserver interface
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "pObserver" is NULL.
// - VmbErrorResources: The observer was in use
//
// Details: As new frames arrive, the observer's FrameReceived method will be called.
// Only one observer can be registered.
//
IMEXPORT VmbErrorType RegisterObserver( const IFrameObserverPtr &pObserver );
//
// Method: UnregisterObserver()
//
// Purpose: Unregisters the observer that was called whenever a new frame arrived
//
IMEXPORT VmbErrorType UnregisterObserver();
//
// Method: GetAncillaryData()
//
// Purpose: Returns the part of a frame that describes the chunk data as an object
//
// Parameters: [out] AncillaryDataPtr& pAncillaryData The wrapped chunk data
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorNotFound: No chunk data present
//
IMEXPORT VmbErrorType GetAncillaryData( AncillaryDataPtr &pAncillaryData );
//
// Method: GetAncillaryData()
//
// Purpose: Returns the part of a frame that describes the chunk data as an object
//
// Parameters: [out] ConstAncillaryDataPtr& pAncillaryData The wrapped chunk data
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorNotFound: No chunk data present
//
IMEXPORT VmbErrorType GetAncillaryData( ConstAncillaryDataPtr &pAncillaryData ) const;
//
// Method: GetBuffer()
//
// Purpose: Returns the complete buffer including image and chunk data
//
// Parameters: [out] VmbUchar_t* pBuffer A pointer to the buffer
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetBuffer( VmbUchar_t* &pBuffer );
//
// Method: GetBuffer()
//
// Purpose: Returns the complete buffer including image and chunk data
//
// Parameters: [out] const VmbUchar_t* pBuffer A pointer to the buffer
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetBuffer( const VmbUchar_t* &pBuffer ) const;
//
// Method: GetImage()
//
// Purpose: Returns only the image data
//
// Parameters: [out] VmbUchar_t* pBuffer A pointer to the buffer
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetImage( VmbUchar_t* &pBuffer );
//
// Method: GetImage()
//
// Purpose: Returns only the image data
//
// Parameters: [out] const VmbUchar_t* pBuffer A pointer to the buffer
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetImage( const VmbUchar_t* &pBuffer ) const;
//
// Method: GetReceiveStatus()
//
// Purpose: Returns the receive status of a frame
//
// Parameters: [out] VmbFrameStatusType& status The receive status
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetReceiveStatus( VmbFrameStatusType &status ) const;
//
// Method: GetImageSize()
//
// Purpose: Returns the memory size of the image
//
// Parameters: [out] VmbUint32_t& imageSize The size in bytes
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetImageSize( VmbUint32_t &imageSize ) const;
//
// Method: GetAncillarySize()
//
// Purpose: Returns memory size of the chunk data
//
// Parameters: [out] VmbUint32_t& ancillarySize The size in bytes
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetAncillarySize( VmbUint32_t &ancillarySize ) const;
//
// Method: GetBufferSize()
//
// Purpose: Returns the memory size of the frame buffer holding
// both the image data and the ancillary data
//
// Parameters: [out] VmbUint32_t& bufferSize The size in bytes
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetBufferSize( VmbUint32_t &bufferSize ) const;
//
// Method: GetPixelFormat()
//
// Purpose: Returns the GenICam pixel format
//
// Parameters: [out] VmbPixelFormatType& pixelFormat The GenICam pixel format
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetPixelFormat( VmbPixelFormatType &pixelFormat ) const;
//
// Method: GetWidth()
//
// Purpose: Returns the width of the image
//
// Parameters: [out] VmbUint32_t& width The width in pixels
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetWidth( VmbUint32_t &width ) const;
//
// Method: GetHeight()
//
// Purpose: Returns the height of the image
//
// Parameters: [out] VmbUint32_t& height The height in pixels
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetHeight( VmbUint32_t &height ) const;
//
// Method: GetOffsetX()
//
// Purpose: Returns the x offset of the image
//
// Parameters: [out] VmbUint32_t& offsetX The x offset in pixels
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetOffsetX( VmbUint32_t &offsetX ) const;
//
// Method: GetOffsetY()
//
// Purpose: Returns the y offset of the image
//
// Parameters: [out] VmbUint32_t& offsetY The y offset in pixels
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetOffsetY( VmbUint32_t &offsetY ) const;
//
// Method: GetFrameID()
//
// Purpose: Returns the frame ID
//
// Parameters: [out] VmbUint64_t& frameID The frame ID
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetFrameID( VmbUint64_t &frameID ) const;
//
// Method: GetTimeStamp()
//
// Purpose: Returns the time stamp
//
// Parameters: [out] VmbUint64_t& timestamp The time stamp
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetTimestamp( VmbUint64_t &timestamp ) const;
bool GetObserver( IFrameObserverPtr &observer ) const;
private:
struct Impl;
Impl *m_pImpl;
// No default ctor
Frame();
// No copy ctor
Frame( Frame& );
// No assignment operator
Frame& operator=( const Frame& );
};
typedef std::vector<FramePtr> FramePtrVector;
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,84 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: ICameraFactory.h
Description: Definition of interface AVT::VmbAPI::ICameraFactory.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_ICAMERAFACTORY_H
#define AVT_VMBAPI_ICAMERAFACTORY_H
#include <VimbaC/Include/VimbaC.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Camera.h>
namespace AVT {
namespace VmbAPI {
class ICameraFactory
{
public:
//
// Method: CreateCamera()
//
// Purpose: Factory method to create a camera that extends the Camera class
//
// Parameters:
//
// [in ] const char* pCameraID The ID of the camera
// [in ] const char* pCameraName The name of the camera
// [in ] const char* pCameraModel The model name of the camera
// [in ] const char* pCameraSerialNumber The serial number of the camera
// [in ] const char* pInterfaceID The ID of the interface the camera is connected to
// [in ] VmbInterfaceType interfaceType The type of the interface the camera is connected to
// [in ] const char* pInterfaceName The name of the interface
// [in ] const char* pInterfaceSerialNumber The serial number of the interface
// [in ] VmbAccessModeType interfacePermittedAccess The access privileges for the interface
//
// Details: The ID of the camera may be, among others, one of the following: "169.254.12.13",
// "000f31000001", a plain serial number: "1234567890", or the device ID
// of the underlying transport layer.
//
IMEXPORT virtual CameraPtr CreateCamera( const char *pCameraID,
const char *pCameraName,
const char *pCameraModel,
const char *pCameraSerialNumber,
const char *pInterfaceID,
VmbInterfaceType interfaceType,
const char *pInterfaceName,
const char *pInterfaceSerialNumber,
VmbAccessModeType interfacePermittedAccess) = 0;
//
// Method: ICameraFactory destructor
//
// Purpose: Destroys an instance of class Camera
//
IMEXPORT virtual ~ICameraFactory() {}
};
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,73 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: ICameraListObserver.h
Description: Definition of interface AVT::VmbAPI::ICameraListObserver.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_ICAMERALISTOBSERVER_H
#define AVT_VMBAPI_ICAMERALISTOBSERVER_H
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Camera.h>
#include <vector>
namespace AVT {
namespace VmbAPI {
class ICameraListObserver
{
public:
//
// Method: CameraListChanged()
//
// Purpose: The event handler function that gets called whenever
// an ICameraListObserver is triggered. This occurs most
// likely when a camera was plugged in or out.
//
// Parameters:
//
// [out] CameraPtr pCam The camera that triggered the event
// [out] UpdateTriggerType reason The reason why the callback routine was triggered
// (e.g., a new camera was plugged in)
//
IMEXPORT virtual void CameraListChanged( CameraPtr pCam, UpdateTriggerType reason ) = 0;
//
// Method: ICameraListObserver destructor
//
// Purpose: Destroys an instance of class ICameraListObserver
//
IMEXPORT virtual ~ICameraListObserver() {}
protected:
IMEXPORT ICameraListObserver() { /*No default ctor*/ }
IMEXPORT ICameraListObserver( const ICameraListObserver& ) { /* No copy ctor */ }
};
typedef std::vector<ICameraListObserverPtr> ICameraListObserverPtrVector;
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,69 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: IFeatureObserver.h
Description: Definition of interface AVT::VmbAPI::IFeatureObserver.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_IFEATUREOBSERVER_H
#define AVT_VMBAPI_IFEATUREOBSERVER_H
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Feature.h>
#include <vector>
namespace AVT {
namespace VmbAPI {
class IFeatureObserver
{
public:
//
// Method: FeatureChanged()
//
// Purpose: The event handler function that gets called whenever
// a feature has changed
//
// Parameters:
//
// [in] const FeaturePtr& pFeature The frame that has changed
//
IMEXPORT virtual void FeatureChanged( const FeaturePtr &pFeature ) = 0;
//
// Method: IFeatureObserver destructor
//
// Purpose: Destroys an instance of class IFeatureObserver
//
IMEXPORT virtual ~IFeatureObserver() {}
protected:
IMEXPORT IFeatureObserver() {}
IMEXPORT IFeatureObserver( const IFeatureObserver& ) { /* No copy ctor */ }
};
typedef std::vector<IFeatureObserverPtr> IFeatureObserverPtrVector;
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,72 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: IFrameObserver.h
Description: Definition of interface AVT::VmbAPI::IFrameObserver.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_IFRAMEOBSERVER_H
#define AVT_VMBAPI_IFRAMEOBSERVER_H
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Frame.h>
namespace AVT {
namespace VmbAPI {
class IFrameObserver
{
public:
//
// Method: FrameReceived()
//
// Purpose: The event handler function that gets called whenever
// a new frame is received
//
// Parameters:
//
// [in] const FramePtr pFrame The frame that was received
//
IMEXPORT virtual void FrameReceived( const FramePtr pFrame ) = 0;
//
// Method: IFrameObserver destructor
//
// Purpose: Destroys an instance of class IFrameObserver
//
IMEXPORT virtual ~IFrameObserver() {}
protected:
CameraPtr m_pCamera;
IMEXPORT IFrameObserver( CameraPtr pCamera ) : m_pCamera( pCamera ) {}
IMEXPORT IFrameObserver( IFrameObserver& ) { /* No copy ctor */ }
private:
IFrameObserver() { /* No default ctor */ }
};
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,72 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: IInterfaceListObserver.h
Description: Definition of interface AVT::VmbAPI::IInterfaceListObserver.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_IINTERFACELISTOBSERVER_H
#define AVT_VMBAPI_IINTERFACELISTOBSERVER_H
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Interface.h>
#include <vector>
namespace AVT {
namespace VmbAPI {
class IInterfaceListObserver
{
public:
//
// Method: InterfaceListChanged()
//
// Purpose: The event handler function that gets called whenever
// an IInterfaceListObserver is triggered.
//
// Parameters:
//
// [out] InterfacePtr pInterface The interface that triggered the event
// [out] UpdateTriggerType reason The reason why the callback routine was triggered
//
IMEXPORT virtual void InterfaceListChanged( InterfacePtr pInterface, UpdateTriggerType reason ) = 0;
//
// Method: IInterfaceListObserver destructor
//
// Purpose: Destroys an instance of class IInterfaceListObserver
//
IMEXPORT virtual ~IInterfaceListObserver() {}
protected:
IMEXPORT IInterfaceListObserver() {};
IMEXPORT IInterfaceListObserver( const IInterfaceListObserver& ) { /* No copy ctor */ }
IMEXPORT IInterfaceListObserver& operator=( const IInterfaceListObserver& ) { /* No assignment operator */ return *this; }
};
typedef std::vector<IInterfaceListObserverPtr> IInterfaceListObserverPtrVector;
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,170 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: IRegisterDevice.h
Description: Definition of interface AVT::VmbAPI::IRegisterDevice.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_IREGISTERDEVICE_H
#define AVT_VMBAPI_IREGISTERDEVICE_H
#include <VimbaC/Include/VmbCommonTypes.h>
#include <vector>
namespace AVT {
namespace VmbAPI {
class IRegisterDevice
{
public:
virtual ~IRegisterDevice() {};
//
// Method: ReadRegisters()
//
// Purpose: Reads one or more registers consecutively. The number of registers to be read is determined by the number of provided addresses.
//
// Parameters: [in ] const Uint64Vector& addresses A list of register addresses
// [out] Uint64Vector& buffer The returned data as vector
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been read
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been read. See overload ReadRegisters( const Uint64Vector&, Uint64Vector&, VmbUint32_t& ).
//
virtual VmbErrorType ReadRegisters( const Uint64Vector &addresses, Uint64Vector &buffer ) const = 0;
//
// Method: ReadRegisters()
//
// Purpose: Same as ReadRegisters( const Uint64Vector&, Uint64Vector& ), but returns the number of successful read operations in case of an error.
//
// Parameters: [in ] const Uint64Vector& addresses A list of register addresses
// [out] Uint64Vector& buffer The returned data as vector
// [out] VmbUint32_t& completedReads The number of successfully read registers
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been read
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been read.
//
virtual VmbErrorType ReadRegisters( const Uint64Vector &addresses, Uint64Vector &buffer, VmbUint32_t &completedReads ) const = 0;
//
// Method: WriteRegisters()
//
// Purpose: Writes one or more registers consecutively. The number of registers to be written is determined by the number of provided addresses.
//
// Parameters: [in ] const Uint64Vector& addresses A list of register addresses
// [in ] const Uint64Vector& buffer The data to write as vector
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been written
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been written. See overload WriteRegisters( const Uint64Vector&, const Uint64Vector&, VmbUint32_t& ).
//
virtual VmbErrorType WriteRegisters( const Uint64Vector &addresses, const Uint64Vector &buffer ) = 0;
//
// Method: WriteRegisters()
//
// Purpose: Same as WriteRegisters( const Uint64Vector&, const Uint64Vector& ), but returns the number of successful write operations in case of an error VmbErrorIncomplete.
//
// Parameters: [in ] const Uint64Vector& addresses A list of register addresses
// [in ] const Uint64Vector& buffer The data to write as vector
// [out] VmbUint32_t& completedWrites The number of successfully written registers
//
// Returns:
// - VmbErrorSuccess: If all requested registers have been written
// - VmbErrorBadParameter: Vectors "addresses" and/or "buffer" are empty.
// - VmbErrorIncomplete: If at least one, but not all registers have been written.
//
virtual VmbErrorType WriteRegisters( const Uint64Vector &addresses, const Uint64Vector &buffer, VmbUint32_t &completedWrites ) = 0;
//
// Method: ReadMemory()
//
// Purpose: Reads a block of memory. The number of bytes to read is determined by the size of the provided buffer.
//
// Parameters: [in ] const VmbUint64_t& address The address to read from
// [out] UcharVector& buffer The returned data as vector
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been read
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been read. See overload ReadMemory( const VmbUint64_t&, UcharVector&, VmbUint32_t& ).
//
virtual VmbErrorType ReadMemory( const VmbUint64_t &address, UcharVector &buffer ) const = 0;
//
// Method: ReadMemory()
//
// Purpose: Same as ReadMemory( const Uint64Vector&, UcharVector& ), but returns the number of bytes successfully read in case of an error VmbErrorIncomplete.
//
// Parameters: [in ] const VmbUint64_t& address The address to read from
// [out] UcharVector& buffer The returned data as vector
// [out] VmbUint32_t& sizeComplete The number of successfully read bytes
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been read
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been read.
//
virtual VmbErrorType ReadMemory( const VmbUint64_t &address, UcharVector &buffer, VmbUint32_t &sizeComplete ) const = 0;
//
// Method: WriteMemory()
//
// Purpose: Writes a block of memory. The number of bytes to write is determined by the size of the provided buffer.
//
// Parameters: [in] const VmbUint64_t& address The address to write to
// [in] const UcharVector& buffer The data to write as vector
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been written
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been written. See overload WriteMemory( const VmbUint64_t&, const UcharVector&, VmbUint32_t& ).
//
virtual VmbErrorType WriteMemory( const VmbUint64_t &address, const UcharVector &buffer ) = 0;
//
// Method: WriteMemory()
//
// Purpose: Same as WriteMemory( const Uint64Vector&, const UcharVector& ), but returns the number of bytes successfully written in case of an error VmbErrorIncomplete.
//
// Parameters: [in] const VmbUint64_t& address The address to write to
// [in] const UcharVector& buffer The data to write as vector
// [out] VmbUint32_t& sizeComplete The number of successfully written bytes
//
// Returns:
// - VmbErrorSuccess: If all requested bytes have been written
// - VmbErrorBadParameter: Vector "buffer" is empty.
// - VmbErrorIncomplete: If at least one, but not all bytes have been written.
//
virtual VmbErrorType WriteMemory( const VmbUint64_t &address, const UcharVector &buffer, VmbUint32_t &sizeComplete ) = 0;
};
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,167 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Interface.h
Description: Definition of class AVT::VmbAPI::Interface.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_INTERFACE_H
#define AVT_VMBAPI_INTERFACE_H
#include <VimbaC/Include/VimbaC.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/FeatureContainer.h>
#include <vector>
namespace AVT {
namespace VmbAPI {
class Interface : public FeatureContainer
{
public:
Interface( const VmbInterfaceInfo_t *pInterfaceInfo );
virtual ~Interface();
//
// Method: Open()
//
// Purpose: Open an interface handle for feature access.
//
// Parameters: none
//
// Returns:
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorNotFound: The designated interface cannot be found
//
// Details: An interface can be opened if interface-specific control is required, such as I/O pins
// on a frame grabber card. Control is then possible via feature access methods.
//
IMEXPORT virtual VmbErrorType Open();
//
// Method: Close()
//
// Purpose: Close an interface.
//
// Parameters: none
//
// Returns:
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadHandle: The handle is not valid
//
IMEXPORT virtual VmbErrorType Close();
//
// Method: GetID()
//
// Purpose: Gets the ID of an interface.
//
// Parameters: [out] std::string& interfaceID The ID of the interface
//
// Returns:
// - VmbErrorSuccess: If no error
//
// Details: This information remains static throughout the object's lifetime
//
VmbErrorType GetID( std::string &interfaceID ) const;
//
// Method: GetType()
//
// Purpose: Gets the type, e.g. FireWire, GigE or USB of an interface.
//
// Parameters: [out] VmbInterfaceType& type The type of the interface
//
// Returns:
// - VmbErrorSuccess: If no error
//
// Details: This information remains static throughout the object's lifetime
//
IMEXPORT VmbErrorType GetType( VmbInterfaceType &type ) const;
//
// Method: GetName()
//
// Purpose: Gets the name of an interface.
//
// Parameters: [out] std::string& name The name of the interface
//
// Returns:
// - VmbErrorSuccess: If no error
//
// This information remains static throughout the object's lifetime
//
VmbErrorType GetName( std::string &name ) const;
//
// Method: GetSerialNumber()
//
// Purpose: Gets the serial number of an interface.
//
// Parameters: [out] std::string& serialNumber The serial number of the interface
//
// Returns:
// - VmbErrorSuccess: If no error
//
// This information remains static throughout the object's lifetime
//
VmbErrorType GetSerialNumber( std::string &serialNumber ) const;
//
// Method: GetPermittedAccess()
//
// Purpose: Gets the access mode of an interface.
//
// Parameters: [out] VmbAccessModeType& accessMode The possible access mode of the interface
//
// Returns:
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType GetPermittedAccess( VmbAccessModeType &accessMode ) const;
private:
// Default ctor
Interface();
// Copy ctor
Interface( const Interface& );
// Assignment operator
Interface& operator=( const Interface& );
struct Impl;
Impl *m_pImpl;
// Array functions to pass data across DLL boundaries
IMEXPORT VmbErrorType GetID( char * const pID, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetName( char * const pName, VmbUint32_t &length ) const;
IMEXPORT VmbErrorType GetSerialNumber( char * const pSerial, VmbUint32_t &length ) const;
};
#include <VimbaCPP/Include/Interface.hpp>
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,138 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Interface.hpp
Description: Inline wrapper functions for class AVT::VmbAPI::Interface.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_INTERFACE_HPP
#define AVT_VMBAPI_INTERFACE_HPP
//
// Inline wrapper functions that allocate memory for STL objects in the application's context
// and to pass data across DLL boundaries using arrays
//
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Interface::GetID( std::string &rStrID ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetID( NULL, nLength );
if ( VmbErrorSuccess == res)
{
if( 0 != nLength)
{
try
{
std::vector<std::string::value_type> tmpID( nLength + 1, '\0' );
res = GetID( &tmpID[0], nLength );
if( VmbErrorSuccess == res )
{
rStrID = &*tmpID.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrID.clear();
}
}
return res;
}
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Interface::GetName( std::string &rStrName ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetName( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if( 0 != nLength )
{
try
{
std::vector<std::string::value_type> tmpName( nLength + 1, '\0' );
res = GetName( &tmpName[0], nLength );
if( VmbErrorSuccess == res )
{
rStrName = &*tmpName.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrName.clear();
}
}
return res;
}
// HINT: This information remains static throughout the object's lifetime
inline VmbErrorType Interface::GetSerialNumber( std::string &rStrSerial ) const
{
VmbErrorType res;
VmbUint32_t nLength;
res = GetSerialNumber( NULL, nLength );
if ( VmbErrorSuccess == res )
{
if( 0 != nLength)
{
try
{
std::vector<std::string::value_type> tmpSerial( nLength + 1, '\0');
res = GetSerialNumber( &tmpSerial[0], nLength );
if( VmbErrorSuccess == res )
{
rStrSerial = &*tmpSerial.begin();
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rStrSerial.clear();
}
}
return res;
}
#endif

View File

@@ -0,0 +1,61 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: LoggerDefines.h
Description: Definition of macros for logging.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_LOGGERDEFINES_H
#define AVT_VMBAPI_LOGGERDEFINES_H
#include <VimbaCPP/Include/UserLoggerDefines.h>
#ifndef USER_LOGGER
#include <VimbaCPP/Include/FileLogger.h>
namespace AVT {
namespace VmbAPI {
#define LOGGER_DECL FileLogger
#define LOGGER_DEF FileLogger( "VimbaCPP.log", true )
#define LOGGER_LOG( logger, loggingInfo ) if ( NULL != (logger) ) (logger)->Log( loggingInfo );
// These are all uses of LOGGER_DECL logger declarations
typedef LOGGER_DECL* Logger;
}}
#else
#include <VimbaCPP/Include/UserLoggerDefines.h>
#endif
#include <VimbaCPP/Include/VimbaSystem.h>
#define LOG_FREE_TEXT( txt ) std::string strExc( txt );\
strExc.append( " in function: " );\
strExc.append( __FUNCTION__ );\
LOGGER_LOG( VimbaSystem::GetInstance().GetLogger(), strExc );
#endif

View File

@@ -0,0 +1,65 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: Mutex.h
Description: Definition of class AVT::VmbAPI::Mutex.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_MUTEX
#define AVT_VMBAPI_MUTEX
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#ifdef _WIN32
#include <windows.h>
#else
#include <pthread.h>
#endif
namespace AVT {
namespace VmbAPI {
class Mutex
{
public:
IMEXPORT explicit Mutex( bool bInitLock = false );
IMEXPORT ~Mutex();
IMEXPORT void Lock();
IMEXPORT void Unlock();
protected:
#ifdef _WIN32
HANDLE m_hMutex;
#else
pthread_mutex_t m_Mutex;
#endif
private:
Mutex& operator=( const Mutex& );
Mutex( const Mutex& );
};
}} //namespace AVT::VmbAPI
#endif //AVT_VMBAPI_MUTEX

View File

@@ -0,0 +1,142 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: SharedPointer.h
Description: Definition of an example shared pointer class that can be
used with the Vimba CPP API.
(This include file contains example code only.)
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_SHAREDPOINTER_H
#define AVT_VMBAPI_SHAREDPOINTER_H
#include <VimbaCPP/Include/Mutex.h>
namespace AVT {
namespace VmbAPI {
//Coding style of this file is different to mimic the shared_ptr classes of std and boost.
struct dynamic_cast_tag
{
};
class ref_count_base
{
public:
virtual ~ref_count_base() {;}
virtual void inc() = 0;
virtual void dec() = 0;
virtual long use_count() const = 0;
};
template <class T>
class ref_count : public virtual AVT::VmbAPI::ref_count_base
{
private:
T *m_pObject;
long m_nCount;
Mutex m_Mutex;
ref_count(const ref_count &rRefCount);
ref_count& operator = (const ref_count &rRefCount);
public:
explicit ref_count(T *pObject);
virtual ~ref_count();
virtual void inc();
virtual void dec();
virtual long use_count() const;
};
template <class T>
class shared_ptr
{
private:
typedef shared_ptr<T> this_type;
template<class T2>
friend class shared_ptr;
AVT::VmbAPI::ref_count_base *m_pRefCount;
T *m_pObject;
template <class T2>
static void swap(T2 &rValue1, T2 &rValue2);
public:
shared_ptr();
template <class T2>
explicit shared_ptr(T2 *pObject);
shared_ptr(const shared_ptr &rSharedPointer);
template <class T2>
shared_ptr(const shared_ptr<T2> &rSharedPointer);
template <class T2>
shared_ptr(const shared_ptr<T2> &rSharedPointer, dynamic_cast_tag);
virtual ~shared_ptr();
shared_ptr& operator = (const shared_ptr &rSharedPointer);
template <class T2>
shared_ptr& operator = (const shared_ptr<T2> &rSharedPointer);
void reset();
template <class T2>
void reset(T2 *pObject);
T* get() const;
T& operator * () const;
T* operator -> () const;
long use_count() const;
bool unique() const;
typedef T* this_type::*unspecified_bool_type;
operator unspecified_bool_type () const
{
if(m_pObject == 0)
{
return 0;
}
return &this_type::m_pObject;
}
void swap(shared_ptr &rSharedPointer);
};
template<class T, class T2>
shared_ptr<T> dynamic_pointer_cast(const shared_ptr<T2> &rSharedPointer);
template<class T1, class T2>
bool operator==(const shared_ptr<T1>& sp1, const shared_ptr<T2>& sp2);
template<class T1, class T2>
bool operator!=(const shared_ptr<T1>& sp1, const shared_ptr<T2>& sp2);
}} //namespace AVT::VmbAPI
#include <VimbaCPP/Include/SharedPointer_impl.h>
#endif //AVT_VMBAPI_SHAREDPOINTER_H

View File

@@ -0,0 +1,103 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: SharedPointerDefines.h
Description: Definition of macros for using the standard shared pointer
(std::tr1) for Vimba CPP API.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_SHAREDPOINTERDEFINES_H
#define AVT_VMBAPI_SHAREDPOINTERDEFINES_H
//
// If your version of STL does not provide a shared pointer implementation please see UserSharedPointerDefines.h for information on
// how to use another shared pointer than std::shared_ptr.
//
#ifndef USER_SHARED_POINTER
#include <VimbaCPP/Include/SharedPointer.h>
namespace AVT {
namespace VmbAPI {
#define SP_DECL( T ) AVT::VmbAPI::shared_ptr<T>
#define SP_SET( sp, rawPtr ) (sp).reset( (rawPtr) )
#define SP_RESET( sp ) (sp).reset()
#define SP_ISEQUAL( sp1, sp2 ) ( (sp1) == (sp2) )
#define SP_ISNULL( sp ) ( NULL == (sp) )
#define SP_ACCESS( sp ) (sp).get()
#define SP_DYN_CAST( sp, T ) AVT::VmbAPI::dynamic_pointer_cast<T>(sp)
// These are all uses of a SP_DECL shared_ptr declaration
class Interface;
typedef SP_DECL( Interface ) InterfacePtr;
class Camera;
typedef SP_DECL( Camera ) CameraPtr;
class Feature;
typedef SP_DECL( Feature ) FeaturePtr;
class FeatureContainer;
typedef SP_DECL( FeatureContainer ) FeatureContainerPtr;
class IFeatureObserver;
typedef SP_DECL( IFeatureObserver ) IFeatureObserverPtr;
class Frame;
typedef SP_DECL( Frame ) FramePtr;
class FrameHandler;
typedef SP_DECL( FrameHandler ) FrameHandlerPtr;
class IFrameObserver;
typedef SP_DECL( IFrameObserver ) IFrameObserverPtr;
class AncillaryData;
typedef SP_DECL( AncillaryData ) AncillaryDataPtr;
typedef SP_DECL( const AncillaryData ) ConstAncillaryDataPtr;
class ICameraFactory;
typedef SP_DECL( ICameraFactory ) ICameraFactoryPtr;
class ICameraListObserver;
typedef SP_DECL( ICameraListObserver ) ICameraListObserverPtr;
class IInterfaceListObserver;
typedef SP_DECL( IInterfaceListObserver ) IInterfaceListObserverPtr;
class Mutex;
typedef SP_DECL( Mutex ) MutexPtr;
class BasicLockable;
typedef SP_DECL( BasicLockable ) BasicLockablePtr;
}}
#else
#include <VimbaCPP/Include/UserSharedPointerDefines.h>
#endif
#endif // AVT_VMBAPI_SHAREDPOINTERDEFINES_H

View File

@@ -0,0 +1,289 @@
/*=============================================================================
Copyright (C) 2012 - 2017 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: SharedPointer_impl.h
Description: Implementation of an example shared pointer class for the Vimba
CPP API.
(This include file contains example code only.)
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_SHAREDPOINTER_IMPL_H
#define AVT_VMBAPI_SHAREDPOINTER_IMPL_H
#include <VimbaCPP/Include/SharedPointer.h>
#include <stdexcept>
namespace AVT {
namespace VmbAPI {
template <class T>
ref_count<T>::ref_count(const ref_count &rRefCount)
{
}
template <class T>
ref_count<T>& ref_count<T>::operator = (const ref_count &rRefCount)
{
//This is a dummy method to satisfy the compiler
return *this;
}
template <class T>
ref_count<T>::ref_count(T *pObject)
: m_pObject(pObject)
, m_nCount(1)
{
}
template <class T>
ref_count<T>::~ref_count()
{
if(NULL != m_pObject)
{
delete m_pObject;
}
m_Mutex.Unlock();
}
template <class T>
void ref_count<T>::inc()
{
m_Mutex.Lock();
m_nCount++;
m_Mutex.Unlock();
}
template <class T>
void ref_count<T>::dec()
{
m_Mutex.Lock();
if( m_nCount == 0 )
{
throw std::logic_error("shared pointer, used incorectly");
}
if(m_nCount > 1)
{
m_nCount--;
m_Mutex.Unlock();
}
else
{
// m_Mutex will be unlocked in d'tor
delete this;
}
}
template <class T>
long ref_count<T>::use_count() const
{
return m_nCount;
}
template <class T>
template <class T2>
void shared_ptr<T>::swap(T2 &rValue1, T2 &rValue2)
{
T2 buffer = rValue1;
rValue1 = rValue2;
rValue2 = buffer;
}
template <class T>
shared_ptr<T>::shared_ptr()
: m_pRefCount(NULL)
, m_pObject(NULL)
{
}
template <class T>
template <class T2>
shared_ptr<T>::shared_ptr(T2 *pObject)
: m_pRefCount(NULL)
, m_pObject(NULL)
{
m_pRefCount = new ref_count<T2>(pObject);
if(NULL == m_pRefCount)
{
delete pObject;
throw std::bad_alloc();
}
m_pObject = pObject;
}
template <class T>
template <class T2>
shared_ptr<T>::shared_ptr(const shared_ptr<T2> &rSharedPointer)
: m_pRefCount(NULL)
, m_pObject(NULL)
{
if(NULL != rSharedPointer.m_pRefCount)
{
rSharedPointer.m_pRefCount->inc();
m_pRefCount = rSharedPointer.m_pRefCount;
m_pObject = rSharedPointer.m_pObject;
}
}
template <class T>
template <class T2>
shared_ptr<T>::shared_ptr(const shared_ptr<T2> &rSharedPointer, dynamic_cast_tag)
: m_pRefCount(NULL)
, m_pObject(NULL)
{
if(NULL != rSharedPointer.m_pRefCount)
{
T *pObject = dynamic_cast<T*>(rSharedPointer.m_pObject);
if(NULL != pObject)
{
rSharedPointer.m_pRefCount->inc();
m_pRefCount = rSharedPointer.m_pRefCount;
m_pObject = pObject;
}
}
}
template <class T>
shared_ptr<T>::shared_ptr(const shared_ptr &rSharedPointer)
: m_pRefCount(NULL)
, m_pObject(NULL)
{
if(NULL != rSharedPointer.m_pRefCount)
{
rSharedPointer.m_pRefCount->inc();
m_pRefCount = rSharedPointer.m_pRefCount;
m_pObject = rSharedPointer.m_pObject;
}
}
template <class T>
shared_ptr<T>::~shared_ptr()
{
if(NULL != m_pRefCount)
{
m_pRefCount->dec();
m_pRefCount = NULL;
m_pObject = NULL;
}
}
template <class T>
template <class T2>
shared_ptr<T>& shared_ptr<T>::operator = (const shared_ptr<T2> &rSharedPointer)
{
shared_ptr(rSharedPointer).swap(*this);
return *this;
}
template <class T>
shared_ptr<T>& shared_ptr<T>::operator = (const shared_ptr &rSharedPointer)
{
shared_ptr(rSharedPointer).swap(*this);
return *this;
}
template <class T>
void shared_ptr<T>::reset()
{
shared_ptr().swap(*this);
}
template <class T>
template <class T2>
void shared_ptr<T>::reset(T2 *pObject)
{
shared_ptr(pObject).swap(*this);
}
template <class T>
T* shared_ptr<T>::get() const
{
return m_pObject;
}
template <class T>
T& shared_ptr<T>::operator * () const
{
return *m_pObject;
}
template <class T>
T* shared_ptr<T>::operator -> () const
{
return m_pObject;
}
template <class T>
long shared_ptr<T>::use_count() const
{
if(NULL == m_pRefCount)
{
return 0;
}
return m_pRefCount->use_count();
}
template <class T>
bool shared_ptr<T>::unique() const
{
return (use_count() == 1);
}
template <class T>
void shared_ptr<T>::swap(shared_ptr &rSharedPointer)
{
swap(m_pObject, rSharedPointer.m_pObject);
swap(m_pRefCount, rSharedPointer.m_pRefCount);
}
template<class T, class T2>
shared_ptr<T> dynamic_pointer_cast(const shared_ptr<T2> &rSharedPointer)
{
return shared_ptr<T>(rSharedPointer, dynamic_cast_tag());
}
template <class T1, class T2>
bool operator==(const shared_ptr<T1>& sp1, const shared_ptr<T2>& sp2)
{
return sp1.get() == sp2.get();
}
template <class T1, class T2>
bool operator!=(const shared_ptr<T1>& sp1, const shared_ptr<T2>& sp2)
{
return sp1.get() != sp2.get();
}
}} //namespace AVT::VmbAPI
#endif //AVT_VMBAPI_SHAREDPOINTER_IMPL_H

View File

@@ -0,0 +1,52 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: UserLoggerDefines.h
Description: Definition of macros used for different logging methods.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_USERLOGGERDEFINES_H
#define AVT_VMBAPI_USERLOGGERDEFINES_H
//
// To use your own logger implementation add the define USER_LOGGER to your project / compiler settings and complete this header file.
//
// Add all your required logger implementation headers here.
// HINT: #include <VimbaCPP/Include/FileLogger.h> is an example and can be safely removed.
#include <VimbaCPP/Include/FileLogger.h>
namespace AVT {
namespace VmbAPI {
#define LOGGER_DECL FileLogger
#define LOGGER_DEF FileLogger( "VimbaCPP.log", true )
#define LOGGER_LOG( logger, loggingInfo ) if ( NULL != (logger) ) (logger)->Log( loggingInfo );
// These are all uses of LOGGER_DECL logger declarations
typedef LOGGER_DECL* Logger;
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,93 @@
#ifndef AVT_VMBAPI_USERSHAREDPOINTER_H
#define AVT_VMBAPI_USERSHAREDPOINTER_H
#include "..\..\..\..\VimbaNET\Include\NetPointer.h"
namespace AVT {
namespace VmbAPINET {
ref class Camera;
ref class Interface;
ref class Frame;
ref class Feature;
ref class AncillaryData;
};
};
namespace AVT {
namespace VmbAPI {
// Set the calls for your implementation of the shared pointer functions
// a) Declaration
// b) Reset with argument
// c) Reset without argument
// d) == operator
// e) NULL test
// f) Access to underlying raw pointer
// a) This is the define for a declaration.
#define SP_DECL( T ) NetPointer<T>
// b) This is the define for setting an existing shared pointer.
#define SP_SET( sp, rawPtr ) sp.Reset( rawPtr )
// c) This is the define for resetting without an argument to decrease the ref count.
#define SP_RESET( sp ) sp.Reset()
// d) This is the define for the equal operator. Shared pointers are usually considered equal when the raw pointers point to the same address.
#define SP_ISEQUAL( sp1, sp2 ) sp1.IsEqualTo(sp2)
// e) This is the define for the NULL check.
#define SP_ISNULL( sp ) sp.IsNull()
// f) This is the define for the raw pointer access. This is usually accomplished through the dereferencing operator (->).
#define SP_ACCESS( sp ) sp.AccessNative()
class Camera;
typedef NetPointer<Camera, AVT::VmbAPINET::Camera> CameraPtr;
class Interface;
typedef NetPointer<Interface, AVT::VmbAPINET::Interface> InterfacePtr;
class Feature;
typedef NetPointer<Feature, AVT::VmbAPINET::Feature> FeaturePtr;
class FeatureContainer;
typedef SP_DECL( FeatureContainer ) FeatureContainerPtr;
class IFeatureObserver;
typedef SP_DECL( IFeatureObserver ) IFeatureObserverPtr;
class Frame;
typedef NetPointer<Frame, AVT::VmbAPINET::Frame> FramePtr;
class FrameHandler;
typedef SP_DECL( FrameHandler ) FrameHandlerPtr;
class IFrameObserver;
typedef SP_DECL( IFrameObserver ) IFrameObserverPtr;
class AncillaryData;
typedef NetPointer<AncillaryData, AVT::VmbAPINET::AncillaryData> AncillaryDataPtr;
typedef NetPointer<AncillaryData, AVT::VmbAPINET::AncillaryData> ConstAncillaryDataPtr;
class ICameraFactory;
typedef SP_DECL( ICameraFactory) ICameraFactoryPtr;
class IInterfaceListObserver;
typedef SP_DECL( IInterfaceListObserver ) IInterfaceListObserverPtr;
class ICameraListObserver;
typedef SP_DECL( ICameraListObserver ) ICameraListObserverPtr;
class Mutex;
typedef SP_DECL( Mutex ) MutexPtr;
class BasicLockable;
typedef SP_DECL( BasicLockable ) BasicLockablePtr;
}}
#include "..\..\..\..\VimbaNET\Include\NetCamera.h"
#include "..\..\..\..\VimbaNET\Include\NetInterface.h"
#include "..\..\..\..\VimbaNET\Include\NetFrame.h"
#include "..\..\..\..\VimbaNET\Include\NetFeature.h"
#include "..\..\..\..\VimbaNET\Include\NetAncillaryData.h"
#endif /* AVT_VMBAPI_USERSHAREDPOINTER_H */

View File

@@ -0,0 +1,39 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: VimbaCPP.h
Description: Main include file for Vimba CPP API.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/Camera.h>
#include <VimbaCPP/Include/Interface.h>
#include <VimbaCPP/Include/VimbaSystem.h>
#include <VimbaCPP/Include/FeatureContainer.h>
#include <VimbaCPP/Include/ICameraFactory.h>
#include <VimbaCPP/Include/ICameraListObserver.h>
#include <VimbaCPP/Include/IInterfaceListObserver.h>
#include <VimbaCPP/Include/IFeatureObserver.h>
#include <VimbaCPP/Include/IFrameObserver.h>
#include <VimbaCPP/Include/Frame.h>

View File

@@ -0,0 +1,79 @@
/*=============================================================================
Copyright (C) 2012 - 2017 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: VimbaCPPCommon.h
Description: Common type definitions used in Vimba CPP API.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_CPPCOMMON_H
#define AVT_VMBAPI_CPPCOMMON_H
#if defined (_WIN32)
#if defined AVT_VMBAPI_CPP_EXPORTS // DLL exports
#define IMEXPORT __declspec(dllexport)
#elif defined AVT_VMBAPI_CPP_LIB // static LIB
#define IMEXPORT
#else // import
#define IMEXPORT __declspec(dllimport)
#endif
#elif defined (__GNUC__) && (__GNUC__ >= 4) && defined (__ELF__)
#define IMEXPORT
#elif defined (__APPLE__)
#define IMEXPORT
#else
#error Unknown platform, file needs adaption
#endif
#include <vector>
#include <string>
#include "VimbaC/Include/VmbCommonTypes.h"
namespace AVT {
namespace VmbAPI {
enum UpdateTriggerType
{
UpdateTriggerPluggedIn = 0, // A new camera was discovered by Vimba
UpdateTriggerPluggedOut = 1, // A camera has disappeared from the bus
UpdateTriggerOpenStateChanged = 3 // The possible opening mode of a camera has changed (e.g., because it was opened by another application)
};
//
// Indicate the frame allocation mode.
//
enum FrameAllocationMode
{
FrameAllocation_AnnounceFrame = 0, // Use announce frame mode
FrameAllocation_AllocAndAnnounceFrame = 1 // Use alloc and announce mode
};
typedef std::vector<VmbUint64_t> Uint64Vector;
typedef std::vector<VmbInt64_t> Int64Vector;
typedef std::vector<VmbUchar_t> UcharVector;
typedef std::vector<std::string> StringVector;
class EnumEntry;
typedef std::vector<EnumEntry> EnumEntryVector;
}} // AVT::VmbAPI
#endif

View File

@@ -0,0 +1,379 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-------------------------------------------------------------------------------
File: VimbaSystem.h
Description: Definition of class AVT::VmbAPI::VimbaSystem.
-------------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_SYSTEM_H
#define AVT_VMBAPI_SYSTEM_H
#include <vector>
#include <VimbaC/Include/VimbaC.h>
#include <VimbaCPP/Include/VimbaCPPCommon.h>
#include <VimbaCPP/Include/LoggerDefines.h>
#include <VimbaCPP/Include/SharedPointerDefines.h>
#include <VimbaCPP/Include/Interface.h>
#include <VimbaCPP/Include/Camera.h>
#include <VimbaCPP/Include/ICameraFactory.h>
#include <VimbaCPP/Include/ICameraListObserver.h>
#include <VimbaCPP/Include/IInterfaceListObserver.h>
namespace AVT {
namespace VmbAPI {
typedef std::vector<InterfacePtr> InterfacePtrVector;
class VimbaSystem : public FeatureContainer
{
public:
//
// Method: GetInstance()
//
// Purpose: Returns a reference to the System singleton.
//
// Parameters: none
//
// Returns:
//
// - VimbaSystem&
//
IMEXPORT static VimbaSystem& GetInstance();
//
// Method: QueryVersion()
//
// Purpose: Retrieve the version number of VmbAPI.
//
// Parameters:
//
// [out] VmbVersionInfo_t& version Reference to the struct where version information
// is copied
//
// Returns:
//
// - VmbErrorSuccess: always returned
//
// Details: This function can be called at any time, even before the API is
// initialized. All other version numbers may be queried via feature access
//
IMEXPORT VmbErrorType QueryVersion( VmbVersionInfo_t &version );
//
// Method: Startup()
//
// Purpose: Initialize the VmbAPI module.
//
// Parameters: none
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorInternalFault: An internal fault occurred
//
// Details: On successful return, the API is initialized; this is a necessary call.
// This method must be called before any other VmbAPI function is run.
//
IMEXPORT VmbErrorType Startup();
//
// Method: Shutdown()
//
// Purpose: Perform a shutdown on the API module.
//
// Parameters: none
//
// Returns:
//
// - VmbErrorSuccess: always returned
//
// Details: This will free some resources and deallocate all physical resources if applicable.
//
IMEXPORT VmbErrorType Shutdown();
//
// Method: GetInterfaces()
//
// Purpose: List all the interfaces currently visible to VmbAPI.
//
// Parameters:
//
// [out] InterfacePtrVector& interfaces Vector of shared pointer to Interface object
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorStructSize: The given struct size is not valid for this API version
// - VmbErrorMoreData: More data were returned than space was provided
// - VmbErrorInternalFault: An internal fault occurred
//
// Details: All the interfaces known via a GenTL are listed by this command and filled into the vector provided.
// If the vector is not empty, new elements will be appended.
// Interfaces can be adapter cards or frame grabber cards, for instance.
//
VmbErrorType GetInterfaces( InterfacePtrVector &interfaces );
//
// Method: GetInterfaceByID()
//
// Purpose: Gets a specific interface identified by an ID.
//
// Parameters:
//
// [in ] const char* pID The ID of the interface to get (returned by GetInterfaces())
// [out] InterfacePtr& pInterface Shared pointer to Interface object
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadParameter: "pID" is NULL.
// - VmbErrorStructSize: The given struct size is not valid for this API version
// - VmbErrorMoreData: More data were returned than space was provided
//
// Details: An interface known via a GenTL is listed by this command and filled into the pointer provided.
// Interface can be an adapter card or a frame grabber card, for instance.
//
IMEXPORT VmbErrorType GetInterfaceByID( const char *pID, InterfacePtr &pInterface );
//
// Method: OpenInterfaceByID()
//
// Purpose: Open an interface for feature access.
//
// Parameters:
//
// [in ] const char* pID The ID of the interface to open (returned by GetInterfaces())
// [out] InterfacePtr& pInterface A shared pointer to the interface
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorNotFound: The designated interface cannot be found
// - VmbErrorBadParameter: "pID" is NULL.
//
//
// Details: An interface can be opened if interface-specific control is required, such as I/O pins
// on a frame grabber card. Control is then possible via feature access methods.
//
IMEXPORT VmbErrorType OpenInterfaceByID( const char *pID, InterfacePtr &pInterface );
//
// Method: GetCameras()
//
// Purpose: Retrieve a list of all cameras.
//
// Parameters:
//
// [out] CameraPtrVector& cameras Vector of shared pointer to Camera object
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorStructSize: The given struct size is not valid for this API version
// - VmbErrorMoreData: More data were returned than space was provided
//
// Details: A camera known via a GenTL is listed by this command and filled into the pointer provided.
//
VmbErrorType GetCameras( CameraPtrVector &cameras );
//
// Method: GetCameraByID()
//
// Purpose: Gets a specific camera identified by an ID. The returned camera is still closed.
//
// Parameters:
//
// [in ] const char* pID The ID of the camera to get
// [out] CameraPtr& pCamera Shared pointer to camera object
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorBadParameter: "pID" is NULL.
// - VmbErrorStructSize: The given struct size is not valid for this API version
// - VmbErrorMoreData: More data were returned than space was provided
//
// Details: A camera known via a GenTL is listed by this command and filled into the pointer provided.
// Only static properties of the camera can be fetched until the camera has been opened.
// "pID" might be one of the following:
// "169.254.12.13" for an IP address,
// "000F314C4BE5" for a MAC address or
// "DEV_1234567890" for an ID as reported by Vimba
//
IMEXPORT VmbErrorType GetCameraByID( const char *pID, CameraPtr &pCamera );
//
// Method: OpenCameraByID()
//
// Purpose: Gets a specific camera identified by an ID. The returned camera is already open.
//
// Parameters:
//
// [in ] const char* pID The unique ID of the camera to get
// [in ] VmbAccessModeType eAccessMode The requested access mode
// [out] CameraPtr& pCamera A shared pointer to the camera
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorApiNotStarted: VmbStartup() was not called before the current command
// - VmbErrorNotFound: The designated interface cannot be found
// - VmbErrorBadParameter: "pID" is NULL.
//
// Details: A camera can be opened if camera-specific control is required, such as I/O pins
// on a frame grabber card. Control is then possible via feature access methods.
// "pID" might be one of the following:
// "169.254.12.13" for an IP address,
// "000F314C4BE5" for a MAC address or
// "DEV_1234567890" for an ID as reported by Vimba
//
IMEXPORT VmbErrorType OpenCameraByID( const char *pID, VmbAccessModeType eAccessMode, CameraPtr &pCamera );
//
// Method: RegisterCameraListObserver()
//
// Purpose: Registers an instance of camera observer whose CameraListChanged() method gets called
// as soon as a camera is plugged in, plugged out, or changes its access status
//
// Parameters:
//
// [in ] const ICameraListObserverPtr& pObserver A shared pointer to an object derived from ICameraListObserver
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "pObserver" is NULL.
// - VmbErrorInvalidCall: If the very same observer is already registered
//
IMEXPORT VmbErrorType RegisterCameraListObserver( const ICameraListObserverPtr &pObserver );
//
// Method: UnregisterCameraListObserver()
//
// Purpose: Unregisters a camera observer
//
// Parameters:
//
// [in ] const ICameraListObserverPtr& pObserver A shared pointer to an object derived from ICameraListObserver
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorNotFound: If the observer is not registered
// - VmbErrorBadParameter: "pObserver" is NULL.
//
IMEXPORT VmbErrorType UnregisterCameraListObserver( const ICameraListObserverPtr &pObserver );
//
// Method: RegisterInterfaceListObserver()
//
// Purpose: Registers an instance of interface observer whose InterfaceListChanged() method gets called
// as soon as an interface is plugged in, plugged out, or changes its access status
//
// Parameters:
//
// [in ] const IInterfaceListObserverPtr& pObserver A shared pointer to an object derived from IInterfaceListObserver
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "pObserver" is NULL.
// - VmbErrorInvalidCall: If the very same observer is already registered
//
IMEXPORT VmbErrorType RegisterInterfaceListObserver( const IInterfaceListObserverPtr &pObserver );
//
// Method: UnregisterInterfaceListObserver()
//
// Purpose: Unregisters an interface observer
//
// Parameters:
//
// [in ] const IInterfaceListObserverPtr& pObserver A shared pointer to an object derived from IInterfaceListObserver
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorNotFound: If the observer is not registered
// - VmbErrorBadParameter: "pObserver" is NULL.
//
IMEXPORT VmbErrorType UnregisterInterfaceListObserver( const IInterfaceListObserverPtr &pObserver );
//
// Method: RegisterCameraFactory()
//
// Purpose: Registers an instance of camera factory. When a custom camera factory is registered, all instances of type camera
// will be set up accordingly.
//
// Parameters:
//
// [in ] const ICameraFactoryPtr& pCameraFactory A shared pointer to an object derived from ICameraFactory
//
// Returns:
//
// - VmbErrorSuccess: If no error
// - VmbErrorBadParameter: "pCameraFactory" is NULL.
//
IMEXPORT VmbErrorType RegisterCameraFactory( const ICameraFactoryPtr &pCameraFactory );
//
// Method: UnregisterCameraFactory()
//
// Purpose: Unregisters the camera factory. After unregistering the default camera class is used.
//
// Returns:
//
// - VmbErrorSuccess: If no error
//
IMEXPORT VmbErrorType UnregisterCameraFactory();
// Mapping of handle to CameraPtr
CameraPtr GetCameraPtrByHandle( const VmbHandle_t handle ) const;
Logger GetLogger() const;
private:
// Singleton.
static VimbaSystem _instance;
VimbaSystem();
VimbaSystem( const VimbaSystem& );
~VimbaSystem();
VimbaSystem& operator=( const VimbaSystem& system );
struct Impl;
Impl *m_pImpl;
IMEXPORT VmbErrorType GetCameras( CameraPtr *pCameras, VmbUint32_t &size );
IMEXPORT VmbErrorType GetInterfaces( InterfacePtr *pInterfaces, VmbUint32_t &size );
};
#include <VimbaCPP/Include/VimbaSystem.hpp>
}} // namespace AVT::VmbAPI
#endif

View File

@@ -0,0 +1,105 @@
/*=============================================================================
Copyright (C) 2012 Allied Vision Technologies. All Rights Reserved.
Redistribution of this file, in original or modified form, without
prior written consent of Allied Vision Technologies is prohibited.
-----------------------------------------------------------------------------
File: VimbaSystem.hpp
Description: Inline wrapper functions for class AVT::VmbAPI::VimbaSystem.
-----------------------------------------------------------------------------
THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF TITLE,
NON-INFRINGEMENT, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
=============================================================================*/
#ifndef AVT_VMBAPI_VIMBASYSTEM_HPP
#define AVT_VMBAPI_VIMBASYSTEM_HPP
//
// Inline wrapper functions that allocate memory for STL objects in the application's context
// and to pass data across DLL boundaries using arrays
//
inline VmbErrorType VimbaSystem::GetInterfaces( InterfacePtrVector &rInterfaces )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetInterfaces( NULL, nSize );
if ( VmbErrorSuccess == res )
{
if( 0 != nSize)
{
try
{
InterfacePtrVector tmpInterfaces( nSize );
res = GetInterfaces( &tmpInterfaces[0], nSize );
if( VmbErrorSuccess == res )
{
rInterfaces.swap( tmpInterfaces);
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rInterfaces.clear();
}
}
return res;
}
inline VmbErrorType VimbaSystem::GetCameras( CameraPtrVector &rCameras )
{
VmbErrorType res;
VmbUint32_t nSize;
res = GetCameras( NULL, nSize );
if ( VmbErrorSuccess == res)
{
if( 0 != nSize)
{
try
{
CameraPtrVector tmpCameras( nSize );
res = GetCameras( &tmpCameras[0], nSize );
if( VmbErrorSuccess == res )
{
if( nSize < tmpCameras.size() )
{
tmpCameras.resize( nSize);
}
rCameras.swap( tmpCameras );
}
}
catch(...)
{
return VmbErrorResources;
}
}
else
{
rCameras.clear();
}
}
return res;
}
#endif