Exemple #1
0
static const string& GetModuleName(const char* moduleName)
{
    CFastMutexGuard GUARD(s_ModuleNameMutex);
    static CSafeStatic< set<string> > s_ModuleNames;
    const string& s = *s_ModuleNames.Get().insert(moduleName).first;
    CClassTypeInfoBase::RegisterModule(s);
    return s;
}
CEntrez2_id_list::TConstUidIterator
CEntrez2_id_list::GetConstUidIterator() const
{
    if (CanGetUids()) {
        return TConstUidIterator(GetUids(), kUidSize);
    } else {
        return TConstUidIterator(s_EmptyList.Get(), kUidSize);
    }
}
CValueConvert<SSafeSqlCP, CDB_Object>::operator const CTime&(void) const
{
    static CSafeStatic<CTime> value;

    if (m_Value.IsNULL()) {
        return value.Get();
    }

    CheckType(m_Value, eDB_SmallDateTime, eDB_DateTime);

    EDB_Type cur_type = m_Value.GetType();

    if (cur_type == eDB_SmallDateTime) {
        return static_cast<const CDB_SmallDateTime&>(m_Value).Value();
    } else if (cur_type == eDB_DateTime) {
        return static_cast<const CDB_DateTime&>(m_Value).Value();
    } else {
        ReportTypeConvError(cur_type, "CTime");
    }

    return value.Get();
}
Exemple #4
0
CObjectOStream::CObjectOStream(ESerialDataFormat format,
                               CNcbiOstream& out, EOwnership edeleteOut)
    : m_Output(out, edeleteOut == eTakeOwnership), m_Fail(fNoError), m_Flags(fFlagNone),
      m_Separator(""),
      m_DataFormat(format),
      m_ParseDelayBuffers(eDelayBufferPolicyNotSet),
      m_SpecialCaseWrite(eWriteAsNormal),
      m_AutoSeparator(false),
      m_WriteNamedIntegersByValue(false),
      m_FastWriteDouble(s_FastWriteDouble->Get()),
      m_EnforceWritingDefaults(false),
      m_FixMethod(x_GetFixCharsMethodDefault()),
      m_VerifyData(x_GetVerifyDataDefault())
{
}
Exemple #5
0
void CRequestContext::SetHitID(const string& hit)
{
    if ( m_LoggedHitID ) {
        // Show warning when changing hit id after is has been logged.
        ERR_POST_X(28, Warning << "Changing hit ID after one has been logged. "
            "New hit id is: " << hit);
    }
    static CSafeStatic<TOnBadHitId> action;
    if ( !IsValidHitID(hit) ) {
        switch ( action->Get() ) {
        case eOnBadPHID_Ignore:
            return;
        case eOnBadPHID_AllowAndReport:
            // Use Warning if bad hit id is acceptable.
            ERR_POST_X(27, Warning << "Bad hit ID format: " << hit);
            break;
        case eOnBadPHID_IgnoreAndReport:
            ERR_POST_X(27, "Bad hit ID format: " << hit);
            return;
        case eOnBadPHID_Throw:
            NCBI_THROW(CRequestContextException, eBadHit,
                "Bad hit ID format: " + hit);
            break;
        case eOnBadPHID_Allow:
            break;
        }
    }
    x_SetProp(eProp_HitID);
    if (m_HitID != hit) {
        m_SubHitID = 0;
        m_SubHitIDCache.clear();
    }
    m_HitID = hit;
    m_LoggedHitID = false;
    x_LogHitID();
}
Exemple #6
0
static int s_GetDiagHandler(void)
{
    static CSafeStatic<NCBI_PARAM_TYPE(VDB, DIAG_HANDLER)> s_Value;
    return s_Value->Get();
}
Exemple #7
0
EFixNonPrint CObjectOStream::x_GetFixCharsMethodDefault(void) const
{
    static CSafeStatic<TSerialFixChars> s_SerialFixChars;
    return s_SerialFixChars->Get();
}