Hi!

When we discussed the provider API and its messages, I presented some 
template class that construct BLR dynamic and with some C++ish be able 
to work with then using strong types.

For the C++ external routines success, construction of static messages 
should be much more simple.

Here I show you an example (not directly related with external routines):

----------------
int main(int argc, const char* const argv[])
{
     FB_MESSAGE(Message,
         (FB_SMALLINT, smallInt0)
         (FB_INTEGER, integer0)
         (FB_BIGINT, bigInt0)
         (FB_SCALED_BIGINT(3), bigInt3)
         (FB_VARCHAR(10), str10)
     )

     Message::BLR();    // returns the message BLR
Message::SIZE();    // returns the size of a message

     Message message;
     message.smallInt0 = 1;
     message.smallInt0Null = 0;

     message.bigInt3 = 3123;    // 3.123

     message.str10.set("123");

     return 0;
}
----------------

FB_MESSAGE could be created in all kind of scopes (local, global, 
struct/class).

Everything (this includes the data returned by BLR and the number 
returned by SIZE) is done at compile time. It creates a struct with all 
fields and they correspondent fieldNull slot.

To make this possible, I need to use boost.preprocessor library. 
Boost.preprocessor is a header-only library.

Boost has an utility (bcp) which may catch a subset of it and export to 
another directory, optionally renaming the boost namespace.

This is good to embed it as private library in another library, but it 
don't rename macros.

Since this is for our public headers, and looks not ok to add a 
dependency to boost, I suggest we try the bcp approach more some work to 
rename BOOST_ identifier to something like FB_BOOST (or FB_IMPL_BOOST). 
Note, this set of macros are not going to be used by users, but to 
implement our macros.

The files would live in include/firebird/impl.

Boost license: http://www.boost.org/LICENSE_1_0.txt

Comments?


Adriano


------------------------------------------------------------------------------
EditLive Enterprise is the world's most technically advanced content
authoring tool. Experience the power of Track Changes, Inline Image
Editing and ensure content is compliant with Accessibility Checking.
http://p.sf.net/sfu/ephox-dev2dev
Firebird-Devel mailing list, web interface at 
https://lists.sourceforge.net/lists/listinfo/firebird-devel

Reply via email to