Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 25, 2011, 2:47:49 PM (13 years ago)
Author:
landauf
Message:

output contexts are now defined as functions instead of global constants. this should avoid a static initialization fiasco and reduces the amount of context registrations (previosly it was N*M registrations with N = number of contexts and M = number of source files, now they are registered on demand). slightly worse performance though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/output/src/libraries/util/output/OutputDefinitions.h

    r8774 r8777  
    5858
    5959    typedef uint64_t OutputContext;
     60    typedef OutputContext (OutputContextFunction)();
    6061
    6162    extern _UtilExport OutputContext registerContext(const std::string& name);
     
    6566        static const OutputContext all       = 0xFFFFFFFFFFFFFFFF;
    6667        static const OutputContext none      = 0x0000000000000000;
    67         static const OutputContext undefined = registerContext("undefined");
    6868
    69         static const OutputContext test1     = registerContext("test1");
    70         static const OutputContext test2     = registerContext("test2");
    71         static const OutputContext output    = registerContext("output");
     69        namespace
     70        {
     71            OutputContext undefined()   { static OutputContext value = registerContext("undefined");    return value; }
     72
     73            OutputContext test1()       { static OutputContext value = registerContext("test1");        return value; }
     74            OutputContext test2()       { static OutputContext value = registerContext("test2");        return value; }
     75            OutputContext output()      { static OutputContext value = registerContext("output");       return value; }
     76        }
    7277    }
    7378}
Note: See TracChangeset for help on using the changeset viewer.