Ignore:
Timestamp:
Mar 27, 2009 4:54:09 PM (14 years ago)
Author:
gah
Message:

Begin reorganizing Rappture C++ API, starting with the use of
Rappture::Outcome.

Instead of returning an Outcome and expecting every routine to
save it, pass it as a reference. Let's strip it down to what's
needed right now and add back functionality as required.

Right now too many return values are ignored in the rappture library.
We need to check all results and return the error messages via
the Outcome. At the topmost level where is touches the developer
API we can drop the error checking or turn it on via an environment
variable.

Example. Not enough checks are made for memory allocation failure.
If the application is running on an over-committed server memory
allocation errors will be silently passed on. It's okay to be
fault tolerant where possible, but if we fail to check in the internal
library functions, it's too late.

--gah

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpEncode.h

    r1264 r1366  
    1515#define RAPPTURE_ENCODE_H
    1616
     17#include <RpOutcome.h>
    1718#include <RpBuffer.h>
    18 #include <RpOutcome.h>
    1919
    20 #define RPENC_Z      1
    21 #define RPENC_B64    2
    22 #define RPENC_HDR    4
     20namespace Rappture {
     21namespace encoding {
    2322
    24 #ifdef __cplusplus
    25 extern "C" {
    26 namespace Rappture {
    27     namespace encoding {
    28 #endif // ifdef __cplusplus
     23#define RPENC_Z      (1<<0)
     24#define RPENC_B64    (1<<1)
     25#define RPENC_HDR    (1<<2)
    2926
    3027int isbinary(const char* buf, int size);
    3128size_t isencoded(const char* buf, int size);
    32 Rappture::Outcome encode (Rappture::Buffer& buf, size_t flags);
    33 Rappture::Outcome decode (Rappture::Buffer& buf, size_t flags);
     29bool encode(Rappture::Outcome &err, Rappture::Buffer& buf, size_t flags);
     30bool decode(Rappture::Outcome &err, Rappture::Buffer& buf, size_t flags);
    3431
    35 #ifdef __cplusplus
    36     } // namespace encoding
    37 } // namespace Rappture
    38 } // extern C
    39 #endif // ifdef __cplusplus
    40 
     32}
     33}
    4134#endif // RAPPTURE_ENCODE_H
Note: See TracChangeset for help on using the changeset viewer.