[ create a new paste ] login | about

Link: http://codepad.org/8ABE1psM    [ raw code | fork ]

C++, pasted on Jan 6:
class LogId {
public:
    LogId(string id)
    : id_ (id) { }

    ~LogId() { }

    string getId(){ return id_; }

private:
    string id_;
};

static boost::thread_specific_ptr<LogId> ptrId_;

inline void SetTrLogId(const string& id) {
    if (ptrId_.get() == NULL) {

        ptrId_.reset( new LogId(id) );
    }

}

inline string getTrLogId(){

    if (ptrId_.get() == NULL) {
        return string("");
    }

    return ptrId_.get()->getId();
}


Create a new paste based on this one


Comments: