/usr/include/barry/m_desktop.h is in libbarry-dev 0.15-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | ///
/// \file m_desktop.h
/// Mode class for the Desktop mode
///
/*
Copyright (C) 2005-2009, Net Direct Inc. (http://www.netdirect.ca/)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License in the COPYING file at the
root directory of this project for more details.
*/
#ifndef __BARRY_M_DESKTOP_H__
#define __BARRY_M_DESKTOP_H__
#include "dll.h"
#include "m_mode_base.h"
#include "socket.h"
#include "record.h"
namespace Barry {
// forward declarations
class Parser;
class Builder;
class IConverter;
namespace Mode {
//
// Desktop class
//
/// The main interface class to the device databases.
///
/// To use this class, use the following steps:
///
/// - Create a Controller object (see Controller class for more details)
/// - Create this Mode::Desktop object, passing in the Controller
/// object during construction
/// - Call Open() to open database socket and finish constructing.
/// - Call GetDBDB() to get the device's database database
/// - Call GetDBID() to get a database ID by name
/// - Call LoadDatabase() to retrieve and store a database
///
class BXEXPORT Desktop : public Mode
{
public:
enum CommandType { Unknown, DatabaseAccess };
private:
CommandTable m_commandTable;
DatabaseDatabase m_dbdb;
// external objects (optional, can be null)
const IConverter *m_ic;
protected:
void LoadCommandTable();
void LoadDBDB();
//////////////////////////////////
// overrides
virtual void OnOpen();
public:
Desktop(Controller &con);
Desktop(Controller &con, const IConverter &ic);
~Desktop();
//////////////////////////////////
// meta access
/// Returns DatabaseDatabase object for this connection.
/// Must call Open() first, which loads the DBDB.
const DatabaseDatabase& GetDBDB() const { return m_dbdb; }
unsigned int GetDBID(const std::string &name) const;
unsigned int GetDBCommand(CommandType ct);
void SetIConverter(const IConverter &ic);
//////////////////////////////////
// Desktop mode - database specific
// dirty flag related functions, for sync operations
void GetRecordStateTable(unsigned int dbId, RecordStateTable &result);
void AddRecord(unsigned int dbId, Builder &build); // RecordId is
// retrieved from build, and duplicate IDs are allowed,
// but *not* recommended!
void GetRecord(unsigned int dbId, unsigned int stateTableIndex, Parser &parser);
void SetRecord(unsigned int dbId, unsigned int stateTableIndex, Builder &build);
void ClearDirty(unsigned int dbId, unsigned int stateTableIndex);
void DeleteRecord(unsigned int dbId, unsigned int stateTableIndex);
// pure load/save operations
void LoadDatabase(unsigned int dbId, Parser &parser);
void ClearDatabase(unsigned int dbId);
void SaveDatabase(unsigned int dbId, Builder &builder);
template <class RecordT, class StorageT> void LoadDatabaseByType(StorageT &store);
template <class RecordT, class StorageT> void SaveDatabaseByType(StorageT &store);
template <class StorageT> void LoadDatabaseByName(const std::string &name, StorageT &store);
template <class StorageT> void SaveDatabaseByName(const std::string &name, StorageT &store);
template <class RecordT> void AddRecordByType(uint32_t recordId, const RecordT &rec);
};
}} // namespace Barry::Mode
#endif
|