mentby.com
Blog | Jobs | Help | Signup | Login

loading
REST is more of a loose idea than a specific API or architecture, however
there are some bits and pieces that will help you.

Aesthetics?! Lol, each to their own :-D

****

I'm not sure 'EASILY' applies at all - there are several technologies
involved here (networking, HTTP, JSON/XML/similar) and a stack of libraries
is more usual for the c++ world than an all-in-one library that'll do it
for you. A quick Google search seems to confirm that there's no magic
bullet.

In case it's of any help, here are the libraries I'm currently using or am
aware of:

http://cpp-netlib.github.com/latest/index.html  for networking
Supports both client & server implementations, though I've only used the
client API.
I found the docs a little slow to sink in, as they're a little more
implementation-focused than objective-focused, but the group is active and
the primary developer helpful and very approachable.

http://curl.haxx.se/libcurl/  is a well-known library for URL access and
supports a wide variety of protocols.
I've had no direct experience of it myself, but it's pretty ubiquitous so
support should be easy to access.
It may be easier to use for a c++ newbie than cpp-netlib which is template
heavy.

http://www.codeproject.com/Articles/20027/JSON-Spirit-A-C-JS[..]
JSON [de]serialisation.
I'm using this at the moment, though the API seems..'odd' to me in some
ways.
I found some inconsistencies between docs and code, and between the built
and include-only versions of the library.

If you're still green with c++ I'd probably recommend http://jsoncpp.sourceforge.net/  over json_spirit.
I've not used it in a year or 2, and it's not boost-based, but docs are
helpful and it worked well for me at the time.

More JSON library discussion at http://stackoverflow.com/questions/245973/whats-the-best-c-j[..]

HTH :-)

--
Rob Desbois http://theotherbranch.wordpress.com/
"I disapprove of what you say, but I’ll defend to the death your right to
say it", Voltaire
On first iteration:
* Writer gains the lock
* Reader is blocked while trying to obtain lock
* Writer calls condition.notify_all()
* Writer calls condition.wait(), thus releasing the mutex and blocking
itself until condition.notify_*()
* Reader is unblocked
* Reader calls condition.wait(), releasing the mutex and blocking
itself until condition.notify_*()

:-)
--rob

--
Rob Desbois http://theotherbranch.wordpress.com/
"I disapprove of what you say, but I’ll defend to the death your right to
say it", Voltaire

Read more »

I'm unable to use the reentrant macros for iteration currently..I
think I'm probably misunderstanding their usage, and a push in the
right direction would be much appreciated.

My need is to iterate through a sequence, then iterate through a
sequence nested within each element.
As I understand, I should be able to call (e.g.):
* BOOST_PP_SEQ_FOR_EACH(OP, data, seq) to iterate through the outer sequence
* then in OP(r, data, elem) call BOOST_PP_SEQ_FOR_EACH_R(r, OP2, data, elem)

For me this keeps producing rubbish with a lot of non-expanded macro
names embedded.

I've reduced this down to a minimal example iterating over a
2-dimensional sequence; I know the final line isn't valid C++, I'm
just checking preprocessing results at this stage.
    #include <boost/preprocessor/seq/transform.hpp>

    #define INNER(s, data, elem) <elem>
    #define MIDDLE(s, data, seq) BOOST_PP_SEQ_TRANSFORM_S(s, INNER, data, seq)
    #define OUTER(seqseq) BOOST_PP_SEQ_TRANSFORM( MIDDLE, _, seqseq)

    outer gives: OUTER(  ((a) (b) (c))  ((i) (j) (k))  ((x) (y) (z))  )

Resultant output of this, with preprocessor line directives and empty
lines removed, is:
   outer gives: (
                                   BOOST_PP_SEQ_TAIL_I
             BOOST_PP_TUPLE_ELEM_3_2 BOOST_PP_SEQ_TRANSFORM_O(5,
BOOST_PP_SEQ_TRANSFORM_O(4, BOOST_PP_SEQ_TRANSFORM_O(3, (
                                                         INNER
             , _, (nil)), a), b), c)) (
                                   BOOST_PP_SEQ_TAIL_I
             BOOST_PP_TUPLE_ELEM_3_2 BOOST_PP_SEQ_TRANSFORM_O(6,
BOOST_PP_SEQ_TRANSFORM_O(5, BOOST_PP_SEQ_TRANSFORM_O(4, (
                                                         INNER
             , _, (nil)), i), j), k)) (
                                   BOOST_PP_SEQ_TAIL_I
             BOOST_PP_TUPLE_ELEM_3_2 BOOST_PP_SEQ_TRANSFORM_O(7,
BOOST_PP_SEQ_TRANSFORM_O(6, BOOST_PP_SEQ_TRANSFORM_O(5, (
                                                         INNER
             , _, (nil)), x), y), z))

For reference, I am using the following:
   boost 1.46.00
   g++ (GCC) 4.6.3 20120306 (Red Hat 4.6.3-2)

TIA --rob

Read more »

Group(s)
Profile Widget
Copy and paste this HTML code to your blog or website: