60 bool callCommand(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
82 throw std::invalid_argument(std::string(
"Feature not a command: ")+name);
87 throw std::invalid_argument(std::string(
"Feature not writable: ")+name);
92 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
99 throw std::invalid_argument(ex.
what());
106 bool setBoolean(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
107 bool value,
bool exception)
123 val->SetValue(value);
128 throw std::invalid_argument(std::string(
"Feature not boolean: ")+name);
133 throw std::invalid_argument(std::string(
"Feature not writable: ")+name);
138 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
145 throw std::invalid_argument(ex.
what());
152 bool setInteger(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
169 val->SetValue(value);
174 throw std::invalid_argument(std::string(
"Feature not integer: ")+name);
179 throw std::invalid_argument(std::string(
"Feature not writable: ")+name);
184 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
191 throw std::invalid_argument(ex.
what());
198 bool setIPV4Address(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
199 const char *value,
bool exception)
217 std::stringstream in(value);
220 for (
int i=0; i<4; i++)
223 ip=(ip<<8)|(stoi(elem)&0xff);
231 throw std::invalid_argument(std::string(
"Feature not integer: ")+name);
236 throw std::invalid_argument(std::string(
"Feature not writable: ")+name);
241 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
248 throw std::invalid_argument(ex.
what());
255 bool setFloat(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
256 double value,
bool exception)
272 val->SetValue(value);
277 throw std::invalid_argument(std::string(
"Feature not float: ")+name);
282 throw std::invalid_argument(std::string(
"Feature not writable: ")+name);
287 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
294 throw std::invalid_argument(ex.
what());
301 bool setEnum(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
302 const char *value,
bool exception)
322 entry=val->GetEntryByName(value);
329 val->SetIntValue(entry->GetValue());
335 throw std::invalid_argument(std::string(
"Enumeration '")+name+
336 "' does not contain: "+value);
341 throw std::invalid_argument(std::string(
"Feature not enumeration: ")+name);
346 throw std::invalid_argument(std::string(
"Feature not writable: ")+name);
351 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
358 throw std::invalid_argument(ex.
what());
365 bool setString(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
366 const char *value,
bool exception)
378 switch (node->GetPrincipalInterfaceType())
384 std::string v=std::string(value);
385 if (v ==
"true" || v ==
"True" || v ==
"TRUE")
389 else if (v ==
"false" || v ==
"False" || v ==
"FALSE")
395 p->SetValue(static_cast<bool>(std::stoi(v)));
404 switch (p->GetRepresentation())
407 p->SetValue(std::stoll(std::string(value), 0, 16));
414 std::stringstream in(value);
417 for (
int i=0; i<4; i++)
420 ip=(ip<<8)|(stoi(elem)&0xff);
431 std::stringstream in(value);
434 for (
int i=0; i<4; i++)
437 mac=(mac<<8)|(stoi(elem, 0, 16)&0xff);
445 p->SetValue(std::stoll(std::string(value)));
454 p->SetValue(std::stof(std::string(value)));
465 entry=p->GetEntryByName(value);
472 p->SetIntValue(entry->GetValue());
476 throw std::invalid_argument(std::string(
"Enumeration '")+name+
477 "' does not contain: "+value);
492 throw std::invalid_argument(std::string(
"Feature of unknown datatype: ")+name);
499 throw std::invalid_argument(std::string(
"Feature not writable: ")+name);
504 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
511 throw std::invalid_argument(ex.
what());
518 bool getBoolean(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
519 bool exception,
bool igncache)
535 ret=val->GetValue(
false, igncache);
539 throw std::invalid_argument(std::string(
"Feature not boolean: ")+name);
544 throw std::invalid_argument(std::string(
"Feature not readable: ")+name);
549 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
556 throw std::invalid_argument(ex.
what());
568 if (vmin != 0) *vmin=0;
569 if (vmax != 0) *vmax=0;
582 ret=p->GetCurrentEntry(
false, igncache)->GetValue();
584 if (vmin != 0) *vmin=ret;
585 if (vmax != 0) *vmax=ret;
593 ret=val->GetValue(
false, igncache);
595 if (vmin != 0) *vmin=val->GetMin();
596 if (vmax != 0) *vmax=val->GetMax();
600 throw std::invalid_argument(std::string(
"Feature not integer: ")+name);
606 throw std::invalid_argument(std::string(
"Feature not readable: ")+name);
611 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
618 throw std::invalid_argument(ex.
what());
625 double getFloat(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
626 double *vmin,
double *vmax,
bool exception,
bool igncache)
630 if (vmin != 0) *vmin=0;
631 if (vmax != 0) *vmax=0;
645 ret=val->GetValue(
false, igncache);
647 if (vmin != 0) *vmin=val->GetMin();
648 if (vmax != 0) *vmax=val->GetMax();
652 throw std::invalid_argument(std::string(
"Feature not float: ")+name);
657 throw std::invalid_argument(std::string(
"Feature not readable: ")+name);
662 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
669 throw std::invalid_argument(ex.
what());
676 std::string
getEnum(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
697 ret=entry->GetSymbolic();
701 throw std::invalid_argument(std::string(
"Current value is not defined: ")+name);
706 throw std::invalid_argument(std::string(
"Feature not enumeration: ")+name);
711 throw std::invalid_argument(std::string(
"Feature not readable: ")+name);
716 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
723 throw std::invalid_argument(ex.
what());
730 std::string
getEnum(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
731 std::vector<std::string> &list,
bool exception)
750 val->GetSymbolics(entries);
752 for (
size_t i=0; i<entries.size(); i++)
754 list.push_back(std::string(entries[i]));
761 ret=entry->GetSymbolic();
765 throw std::invalid_argument(std::string(
"Current value is not defined: ")+name);
770 throw std::invalid_argument(std::string(
"Feature not enumeration: ")+name);
775 throw std::invalid_argument(std::string(
"Feature not readable: ")+name);
780 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
787 throw std::invalid_argument(ex.
what());
794 std::string
getString(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
795 bool exception,
bool igncache)
807 switch (node->GetPrincipalInterfaceType())
812 out << p->GetValue(
false, igncache);
819 int64_t value=p->GetValue(
false, igncache);
821 switch (p->GetRepresentation())
824 out << std::hex << value;
828 out << ((value>>24)&0xff) <<
'.' << ((value>>16)&0xff) <<
'.' 829 << ((value>>8)&0xff) <<
'.' << (value&0xff);
833 out << std::hex << std::setfill(
'0');
834 out << std::setw(2) << ((value>>40)&0xff) <<
':' 835 << std::setw(2) << ((value>>32)&0xff) <<
':' 836 << std::setw(2) << ((value>>24)&0xff) <<
':' 837 << std::setw(2) << ((value>>16)&0xff) <<
':' 838 << std::setw(2) << ((value>>8)&0xff) <<
':' 839 << std::setw(2) << (value&0xff);
852 out << p->GetValue(
false, igncache);
859 out << p->GetCurrentEntry()->GetSymbolic();
866 out << p->GetValue(
false, igncache);
873 throw std::invalid_argument(std::string(
"Feature of unknown datatype: ")+name);
880 throw std::invalid_argument(std::string(
"Feature not readable: ")+name);
885 throw std::invalid_argument(std::string(
"Feature not found: ")+name);
892 throw std::invalid_argument(ex.
what());
899 void checkFeature(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
900 const char *value,
bool igncache)
902 std::string cvalue=
getString(nodemap, name,
true, igncache);
904 if (cvalue !=
"" && cvalue != value)
907 out << name <<
" == " << value <<
" expected: " << cvalue;
908 throw std::invalid_argument(out.
str());
912 std::shared_ptr<GenApi::CChunkAdapter>
getChunkAdapter(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
913 const std::string &tltype)
915 std::shared_ptr<GenApi::CChunkAdapter> chunkadapter;
917 if (
setBoolean(nodemap,
"ChunkModeActive",
true))
923 else if (tltype ==
"U3V")
937 const Buffer *buffer, uint32_t ipart)
939 std::string component;
948 if (sel != 0 && part != 0)
955 sel->GetEntries(list);
957 for (
size_t i=0; i<list.size() && component.size() == 0; i++)
963 sel->SetIntValue(entry->GetValue());
975 catch (
const std::exception &)
990 component=
"Intensity";
994 component=
"IntensityCombined";
999 component=
"Disparity";
1003 component=
"Confidence";
1018 std::string
loadFile(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
1026 rf.
attach(nodemap->_Ptr);
1028 if (rf.
openFile(name, std::ios::in))
1030 size_t length=std::numeric_limits<size_t>::max();
1036 catch (
const std::exception &)
1039 size_t off=0, n=512;
1040 std::vector<char> buffer(512);
1042 while (n > 0 && length > 0)
1044 n=rf.
read(buffer.data(), off, std::min(length, buffer.size()), name);
1054 n=rf.
read(buffer.data(), off, n, name);
1060 ret.append(buffer.data(), n);
1073 throw std::invalid_argument(std::string(
"Cannot open file for reading: ")+name);
1080 bool saveFile(
const std::shared_ptr<GenApi::CNodeMapRef> &nodemap,
const char *name,
1081 const std::string &data,
bool exception)
1088 rf.
attach(nodemap->_Ptr);
1090 if (rf.
openFile(name, std::ios::out))
1092 size_t off=0, n=512;
1095 n=rf.
write(data.c_str()+off, off, std::min(static_cast<size_t>(512), data.size()-off), name);
1101 if (off != data.size())
1106 out <<
"Error: Can only write " << off <<
" of " << data.size() <<
" bytes";
1107 throw std::invalid_argument(out.
str());
1117 throw std::invalid_argument(std::string(
"Cannot open file for reading: ")+name);
bool getBoolean(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception, bool igncache)
Get the value of a boolean feature of the given nodemap.
bool setIPV4Address(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception)
Set the value of an integer feature of the given nodemap from an IP address.
Hex number in an edit control.
Connects a chunked DCAM buffer to a node map.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IBoolean
Interface for Boolean properties.
GENICAM_INTERFACE IInteger
Interface for integer properties.
Definition of ODevFileStream and IDevFileStream.
std::istream & getline(std::istream &is, GENICAM_NAMESPACE::gcstring &str)
STL getline.
std::shared_ptr< GenApi::CChunkAdapter > getChunkAdapter(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const std::string &tltype)
NOTE: This function is deprecated.
Adapter between the std::iostreambuf and the SFNC Features representing the device filesystem...
std::string loadFile(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Loads the contents of a file via the GenICam FileAccessControl interface.
Declaration of the CChunkAdapterGeneric class.
int64_t getInteger(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, int64_t *vmin, int64_t *vmax, bool exception, bool igncache)
Get the value of an integer feature of the given nodemap.
virtual GenICam_streamsize write(const char *buf, int64_t offs, int64_t len, const char *pFileName)
writes data into a file
size_t getWidth(std::uint32_t part) const
Returns the width of the image in pixel.
bool setFloat(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, double value, bool exception)
Set the value of a float feature of the given nodemap.
virtual GENICAM_NAMESPACE::gcstring GetSymbolic() const =0
Get symbolic enum value.
bool IsReadable(EAccessMode AccessMode)
Tests if readable.
bool setEnum(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception)
Set the value of an enumeration of the given nodemap.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT ICommand
Interface for command like properties.
bool getImagePresent(std::uint32_t part) const
Returns if a 2D, 3D or confidence image is present in the specified part.
The buffer class encapsulates a Genicam buffer that is provided by a stream.
bool saveFile(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const std::string &data, bool exception)
Loads the contents of the given string as a file via the GenICam FileAccessControl interface...
Declaration of the CChunkAdapterGEV class.
node_vector NodeList_t
a list of node references
void checkFeature(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool igncache)
Checks the value of given feature and throws an exception in case of a mismatch.
size_t getHeight(std::uint32_t part) const
Returns the height of the image in pixel.
std::string getEnum(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Get the value of an enumeration of the given nodemap.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IEnumeration
Interface for enumeration properties.
std::string getComponetOfPart(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const Buffer *buffer, uint32_t ipart)
virtual bool openFile(const char *pFileName, std::ios_base::openmode mode)
open a file on the device
bool setString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, const char *value, bool exception)
Set the value of a feature of the given nodemap.
virtual bool attach(GENAPI_NAMESPACE::INodeMap *pInterface)
attach file protocol adapter to nodemap
uint64_t getPixelFormat(std::uint32_t part) const
Returns the pixel format of the specified part as defined in the PFNC.
virtual GenICam_streamsize read(char *buf, int64_t offs, GenICam_streamsize len, const char *pFileName)
read data from the device into a buffer
bool setBoolean(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool value, bool exception)
Set the value of a boolean feature of the given nodemap.
double getFloat(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, double *vmin, double *vmax, bool exception, bool igncache)
Get the value of a double feature of the given nodemap.
bool callCommand(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception)
Calls the given command.
Connects a generic chunked buffer to a node map.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IString
Interface for string properties.
bool IsWritable(EAccessMode AccessMode)
Tests if writable.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IFloat
Interface for float properties.
bool setInteger(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, int64_t value, bool exception)
Set the value of an integer feature of the given nodemap.
GENICAM_INTERFACE INode
Interface common to all nodes.
GenICam's exception class.
GENICAM_NAMESPACE::gcstring_vector StringList_t
A list of strings.
GENICAM_INTERFACE GENAPI_DECL_ABSTRACT IEnumEntry
Interface of single enum value.
std::string getString(const std::shared_ptr< GenApi::CNodeMapRef > &nodemap, const char *name, bool exception, bool igncache)
Get the value of a feature of the given nodemap.
Connects a chunked U3V buffer to a node map.
virtual bool closeFile(const char *pFileName)
close a file on the device
virtual const char * what() const
Get error description (overwrite from std:exception)
Declaration of the CChunkAdapterU3V class.