Simplifications. Concurrency fixes. Make "non binary" fields (like 'id') work.

This commit is contained in:
JoelKatz
2012-10-05 02:30:54 -07:00
parent a18014ad16
commit fb61337175
2 changed files with 11 additions and 10 deletions

View File

@@ -52,20 +52,26 @@ public:
SField(int fc, SerializedTypeID tid, int fv, const char* fn) :
fieldCode(fc), fieldType(tid), fieldValue(fv), fieldName(fn)
{ codeToField[fieldCode] = this; }
{
boost::mutex::scoped_lock sl(mapMutex);
codeToField[fieldCode] = this;
}
SField(SerializedTypeID tid, int fv, const char *fn) :
fieldCode(FIELD_CODE(tid, fv)), fieldType(tid), fieldValue(fv), fieldName(fn)
{ codeToField[fieldCode] = this; }
{
boost::mutex::scoped_lock sl(mapMutex);
codeToField[fieldCode] = this;
}
SField(int fc) : fieldCode(fc), fieldType(STI_UNKNOWN), fieldValue(0) { ; }
~SField();
static SField::ref getField(int fieldCode);
static SField::ref getField(int fieldType, int fieldValue);
static SField::ref getField(const std::string& fieldName);
static SField::ref getField(SerializedTypeID type, int value) { return getField(FIELD_CODE(type, value)); }
static SField::ref getField(int type, int value) { return getField(FIELD_CODE(type, value)); }
static SField::ref getField(SerializedTypeID type, int value) { return getField(FIELD_CODE(type, value)); }
std::string getName() const;
bool hasName() const { return !fieldName.empty(); }