PVCAM  3.9.x
Programmable Virtual Camera Access Method library
Common Data Types

This page describes shared data types and structures used in code samples.

The data types used in the following structures match the types of PVCAM parameters attributes, PVCAM functions arguments or correspond to standard C++ library containers and types.

CameraContext Structure

The CameraContext structure encapsulates camera-related data used throughout the samples in order to standardize work with multiple cameras. Some of its members are the camera name used in pl_cam_open function, the camera sensor resolution which limits the size of user-defined region passed to pl_exp_setup_seq call, cached readout ports and speed table, or members for handling the EOF callbacks.

struct CameraContext
{
char camName[CAM_NAME_LEN];
bool isCamOpen;
// All members below are initialized once the camera is successfully opened
int16 hcam;
uns16 sensorResX;
uns16 sensorResY;
rgn_type region;
std::vector<SpdtabPort> speedTable;
Event eofEvent;
void* eofContext;
FRAME_INFO eofFrameInfo;
void* eofFrame;
...
};

The Event is a simple platform-independent structure used for notifications between threads with the help of C++11 primitives.

struct Event
{
std::mutex mutex;
std::condition_variable cond;
bool flag;
};

Speed Table Structures

The speed table as declared in CameraContext structure above has a tree-like hierarchy where camera can have one or more ports, each port has one or more speeds and each speed has one or more gains.

The structure describing one port:

struct SpdtabPort
{
int32 value;
std::string name;
std::vector<SpdtabSpeed> speeds;
};

The structure describing one speed.

With most cameras, pixel bit-depth is common to all gains at the particular speed index. Some cameras such as Prime BSI, or Prime BSI Express have different bit-depth values on each gain under the same speed. Therefore, it is recommended to either cache the bit-depth value for each gain, or to not associate the bit-depth with a gain at all and read the bit-depth value from the camera dynamically anytime camera settings change.

struct SpdtabSpeed
{
int32 index;
uns16 pixTimeNs;
std::vector<SpdtabGain> gains;
};

The structure describing one gain:

struct SpdtabGain
{
int32 index;
std::string name;
int16 bitDepth;
};

These structures are a code representation of the concepts explained in Port and Speed Choices chapter.

NVPC Structure

NVPC is a vector container of NVP structures. NVP stands for Name Value Pair. The structure is used to either store enum items received from PVCAM for TYPE_ENUM parameters (encapsulated in ReadEnumeration helper function) or as input parameter to GetMenuSelection function.

struct NVP
{
int32 value;
std::string name;
};
typedef std::vector<NVP> NVPC;

Post-Processing Structures

Certain cameras support additional on-board post-processing. Each such functionality can be enumerated via PVCAM parameters starting with PARAM_PP_.

For more details please refer to Post-Processing chapter.

The structure describing one PP feature:

struct PvcamPpFeature
{
int16 index;
uns32 id;
std::string name;
std::vector<PvcamPpParameter> parameterList;
};

The structure describing one PP parameter:

struct PvcamPpParameter
{
int16 index;
uns32 id;
std::string name;
uns32 minValue;
uns32 maxValue;
uns32 defValue;
};