libsidplayfp 3.0.0
sidbuilder.h
1/*
2 * This file is part of libsidplayfp, a SID player engine.
3 *
4 * Copyright 2011-2025 Leandro Nini <drfiemost@users.sourceforge.net>
5 * Copyright 2007-2010 Antti Lankila
6 * Copyright 2000-2001 Simon White
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 */
22
23#ifndef SIDBUILDER_H
24#define SIDBUILDER_H
25
26#include <set>
27#include <string>
28
29#include "sidplayfp/SidConfig.h"
30
31namespace libsidplayfp
32{
33class sidemu;
34class EventScheduler;
35}
36
40class sidbuilder
41{
42protected:
43 typedef std::set<libsidplayfp::sidemu*> emuset_t;
44
45private:
46 const char * const m_name;
47
48protected:
49 std::string m_errorBuffer;
50
51 emuset_t sidobjs;
52
53protected:
54 virtual libsidplayfp::sidemu* create() = 0;
55
56 virtual const char *getCredits() const = 0;
57
58public:
59 sidbuilder(const char * const name) :
60 m_name(name),
61 m_errorBuffer("N/A") {}
62 virtual ~sidbuilder() {}
63
69 unsigned int usedDevices() const { return sidobjs.size(); }
70
80
86 void unlock(libsidplayfp::sidemu *device);
87
91 void remove();
92
98 const char *name() const { return m_name; }
99
105 const char *error() const { return m_errorBuffer.c_str(); }
106
112 const char *credits() const;
113};
114
115#endif // SIDBUILDER_H
sid_model_t
SID chip model.
Definition SidConfig.h:44
Definition EventScheduler.h:62
Definition sidemu.h:47
const char * error() const
Definition sidbuilder.h:105
void unlock(libsidplayfp::sidemu *device)
Definition sidbuilder.cpp:49
unsigned int usedDevices() const
Definition sidbuilder.h:69
const char * credits() const
Definition sidbuilder.cpp:69
libsidplayfp::sidemu * lock(libsidplayfp::EventScheduler *scheduler, SidConfig::sid_model_t model, bool digiboost)
Definition sidbuilder.cpp:29
void remove()
Definition sidbuilder.cpp:61
const char * name() const
Definition sidbuilder.h:98