CMS 3D CMS Logo

Namespaces | Functions

gs Namespace Reference

Namespaces

namespace  Private

Functions

std::string fileDirname (const char *filename)
std::string fileTail (const char *filename)
std::string joinDir1WithName2 (const char *fname1, const char *fname2)
std::string localFileURI (const char *filename)
bool writeBinaryCatalog (std::ostream &os, const unsigned compressionCode, const unsigned mergeLevel, const std::vector< std::string > &annotations, const AbsCatalog &catalog, const unsigned formatId)

Function Documentation

std::string gs::fileDirname ( const char *  filename)

Definition at line 31 of file uriUtils.cc.

References AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by joinDir1WithName2().

    {
        assert(filename);
        const char *progname = std::strrchr(filename, '/');
        if (progname)
            return std::string(filename, progname - filename);
        else
            return std::string(".");
    }
std::string gs::fileTail ( const char *  filename)

Definition at line 20 of file uriUtils.cc.

References lut2db_cfg::filename, and AlCaHLTBitMon_QueryRunRegistry::string.

Referenced by joinDir1WithName2().

    {
        assert(filename);
        const char *progname = std::strrchr(filename, '/');
        if (progname)
            ++progname;
        else
            progname = filename;
        return std::string(progname);
    }
std::string gs::joinDir1WithName2 ( const char *  fname1,
const char *  fname2 
)

Definition at line 41 of file uriUtils.cc.

References fileDirname(), fileTail(), and AlCaHLTBitMon_QueryRunRegistry::string.

    {
        std::string res(fileDirname(fname1));
        res += '/';
        res += fileTail(fname2);
        return res;
    }
std::string gs::localFileURI ( const char *  filename)

Definition at line 8 of file uriUtils.cc.

References lut2db_cfg::filename, and AlCaHLTBitMon_QueryRunRegistry::string.

    {
        assert(filename);
        if (strlen(filename) == 0) throw gs::IOInvalidArgument(
            "In gs::localFileURI: empty file name");
        std::string uri("file://");
        if (filename[0] != '/')
            uri += "./";
        uri += filename;
        return uri;
    }
bool gs::writeBinaryCatalog ( std::ostream &  os,
const unsigned  compressionCode,
const unsigned  mergeLevel,
const std::vector< std::string > &  annotations,
const AbsCatalog &  catalog,
const unsigned  formatId 
)

Definition at line 4 of file CatalogIO.cc.

    {
        os.seekp(0, std::ios_base::beg);

        const unsigned endianness = 0x01020304;
        const unsigned char sizelong = sizeof(long);

        write_pod(os, formatId);
        write_pod(os, endianness);
        write_pod(os, sizelong);
        write_pod(os, compressionCode);
        write_pod(os, mergeLevel);
        write_pod_vector(os, annotations);

        return !os.fail() && 
               catalog.classId().write(os) && catalog.write(os);
    }