Changeset 1352 for trunk


Ignore:
Timestamp:
Mar 20, 2009, 7:38:19 PM (15 years ago)
Author:
gah
Message:

my first cut at flowvisviewer client based on work by dsk

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/core/RpOutcome.cc

    r1325 r1352  
    150150Outcome::addContext(const char *rem)
    151151{
     152    // FIXME: There should be a stack of contexts
    152153    if (_contextPtr.isNull()) {
    153154        _contextPtr = new std::string();
     
    158159}
    159160
     161#ifdef soon
     162/**
     163 *  Push context information on to the context stack for an outcome.
     164 */
     165void
     166Outcome::pushContext(const char* format, ...)
     167{
     168    char stackSpace[1024];
     169    va_list lst;
     170    size_t n;
     171    char *bufPtr;
     172
     173    va_start(lst, format);
     174    bufPtr = stackSpace;
     175    n = vsnprintf(bufPtr, 1024, format, lst);
     176    if (n >= 1024) {
     177        bufPtr = (char *)malloc(n);
     178        vsnprintf(bufPtr, n, format, lst);
     179    }
     180    _contexts.push_front(bufPtr);
     181}
     182
     183/**
     184 *  Pop the last context from the stack.
     185 */
     186void
     187Outcome::popContext(void)
     188{
     189    _contexts.pop_front();
     190}
     191
     192void
     193Outcome::printContext(void)
     194{
     195    list<const char *>::interator iter;
     196   
     197    for (iter = _contexts.begin(); iter != _contexts.end(); iter++) {
     198        fprintf(stderr, "Called from %s\n", *iter);
     199    }
     200}
     201
     202#endif /*soon*/
     203
    160204/**
    161205 *  Query the context stack from an outcome.
Note: See TracChangeset for help on using the changeset viewer.