Skip to content

Commit

Permalink
refs #107
Browse files Browse the repository at this point in the history
  • Loading branch information
Herbert Koelman committed Dec 1, 2016
1 parent 5bc3121 commit 9b78efb
Show file tree
Hide file tree
Showing 12 changed files with 340 additions and 174 deletions.
8 changes: 3 additions & 5 deletions include/atmi/carray_field.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ namespace atmi {
*
* @param fid the fml field id to setup (as defined in the FML tables)
*/
explicit Tfield ( FLDID32 fid ) : _length (0),_buffer_size(0), _value (NULL) {

set_id ( fid );
explicit Tfield ( FLDID32 fid ) : _length (0),_buffer_size(0), _value (NULL), field(fid) {

// check taht we have a std::string declaration in the FML table
if ( type () != 6 ) {
Expand All @@ -59,9 +57,9 @@ namespace atmi {
*
* @param n the fml field name to setup (as defined in the FML tables)
*/
explicit Tfield ( const char *n ) : _length (0),_buffer_size(0), _value (NULL) {
explicit Tfield ( const char *n ) : _length (0),_buffer_size(0), _value (NULL), field(n) {

setup ( (FLDID32) Fldid32 ( const_cast<char *>(n) ) );
// setup ( (FLDID32) Fldid32 ( const_cast<char *>(n) ) );

// check type matching
if ( type() != 6 ) {
Expand Down
26 changes: 26 additions & 0 deletions include/atmi/definitions.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,36 @@
/*
* globel definitions.
*/

#include <fml32.h>

#ifndef CPP_ATMI_DEFINITIONS_HPP
#define CPP_ATMI_DEFINITIONS_HPP

/** catalog message set */
#define CATD_ATMI_SET 100

namespace atmi {

/** FML field possible types
*/
enum field_types {
fld_short =FLD_SHORT, //!< 0 short in
fld_long =FLD_LONG, //!< 1 long in
fld_char =FLD_CHAR, //!< 2 character
fld_float =FLD_FLOAT, //!< 3 single-precision floa
fld_double =FLD_DOUBLE, //!< 4 double-precision floa
fld_string =FLD_STRING, //!< 5 std::string - null terminated
fld_carray =FLD_CARRAY, //!< 6 character array
fld_ptr =FLD_PTR, //!< 9 pointer to a buffer
fld_buffer_ptr=FLD_FML32, //!< 10 embedded FML32 buffer
fld_view =FLD_VIEW32, //!< 11 embedded VIEW32 buffer
fld_mbstring =FLD_MBSTRING //!< 12 multibyte character array
};

/** alias
*/
typedef field_types field_type;

} // namespace atmi
#endif
22 changes: 22 additions & 0 deletions include/atmi/exceptions.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,28 @@ namespace atmi {
int _error; //!< related Ferror32 error number.
};

/** FML field related exceptions.
*
*/
class field_exception : public buffer_exception {
public:
/** new exception.
*
* @param err Ferror32 value
* @param msg error message
* @param args error message parameters (variadic).
*/
template<typename... Args> field_exception( int err, const char *msg, const Args&... args): buffer_exception(err, msg, args...){
_what = _message + " " + error_message();
};

/** default constructor.
*
* set error message to strerror.
*/
field_exception();
};

/** Tuxedo TP related exceptions
*
*/
Expand Down
Loading

0 comments on commit 9b78efb

Please sign in to comment.