This file is indexed.

/usr/include/CLAM/MIDIManager.hxx is in libclam-dev 1.4.0-7.

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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
/*
 * Copyright (c) 2001-2004 MUSIC TECHNOLOGY GROUP (MTG)
 *                         UNIVERSITAT POMPEU FABRA
 *
 *
 * 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 for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 */

#ifndef __MIDIManager__
#define __MIDIManager__

#include <vector>

#include "MIDIDevice.hxx"
#include "MIDIDeviceList.hxx"

#ifdef WIN32
#define DEFAULT_MIDI_ARCH "portmidi"
#else
#define DEFAULT_MIDI_ARCH "alsa"
#endif

namespace CLAM{

/** This class takes care of all the creation of the registration of
 *  MIDIIn and MIDIOut objects, and the creation of MIDIDevice objects required.
 * It's a singleton class (only must be an instantiation of this class) because and unique object manages all the Devices, MIDIOut and MIDIIn objects provided by the system
 * @see MIDIIn, MIDIOut, MIDIDevice
 */


class MIDIManager
{
	friend class MIDIIn;
	friend class MIDIClocker;
	friend class MIDIOut;
	friend class MIDIDeviceList;
private:
	std::vector<MIDIDevice*> mDevices;

	/** A Meyers-Singleton-style list of all DeviceList */
	static std::vector<MIDIDeviceList*>& DeviceLists(void)
	{
		static std::vector<MIDIDeviceList*> sDeviceLists;
		return sDeviceLists;
	}

	static MIDIManager* _Current(bool set = 0,MIDIManager* m = 0)
	{
		static MIDIManager* sCurrent = 0;
		if (set)
		{
			if (m)
			{
				if (sCurrent) throw Err("Can only have one MIDIManager at a time");
			}
			sCurrent = m;
		}
		return sCurrent;
	}
public:
	typedef std::vector<MIDIDevice*>::const_iterator device_iterator;
	typedef std::vector<MIDIDeviceList*>::const_iterator list_iterator;

	/** Constructor of the class*/
	MIDIManager() throw(Err);

	/** Destructor of the class*/
	~MIDIManager();

	static MIDIManager& Current()
	{
		MIDIManager* p = _Current();

		if (p==0) throw Err("No MIDIManager current");

		return *p;
	}

	/** Find a created MIDIDevice, or NULL when not found
	 *  @param name The name of the MIDIDevice we want to get
	 *  @return the MIDIDevice if it exists, or NULL otherwise
	 */
	MIDIDevice* FindDevice(const std::string& name);

	/** Find a created MIDIDevice, or create it when not found
	 *  @param name The name of the MIDIDevice we want to get
	 *  @return the MIDIDevice if it exists; otherwise method will create and return a new MIDIDevice
	 */
	MIDIDevice* FindOrCreateDevice(const std::string& name);

	/** This method starts the MIDIManager object*/
	void Start(void) throw(Err);

	/** This method stops the MIDIManager object*/
	void Stop(void) throw(Err);

	/** Checks all devices searching data to read*/
	void Check(void);

	/** Retrieve the list of devices available for a given architecture. You can
	 * then use the AvailableDevices() method to retrieve a list of the
	 * available devices for each MIDIDeviceList.
	 *  @param arch The name of architecture wich will be returned the devices. By default is set to "default"
	 *              Valid values include 'portmidi' on all platforms or 'alsa' on Linux.
	 *  @return The list of MIDIDevices
	 */
	MIDIDeviceList* FindList(const std::string& arch = "default");

	/** Global iterator interface for device lists. It can be used
	 *	to obtain the device list for each existent architecture.
	 *  @return The beginning list iterator
	 */
	list_iterator lists_begin() const {return DeviceLists().begin();}

	/** Global iterator interface for device lists. It can be used
	 *	to obtain the device list for each existent architecture.
	 *  @return The ending list iterator
	 */
	list_iterator lists_end() const {return DeviceLists().end();}

	/** Iterator interface for used midi devices. It will iterate
	 *  through the list of devices which have been registered.
	 *  @return The beginning list iterator
	 */
	device_iterator used_devices_begin() const {return mDevices.begin();}
	/** Iterator interface for used midi devices. It will iterate
	 *  through the list of devices which have been registered.
	 *  @return The ending list iterator
	 */
	device_iterator used_devices_end() const {return mDevices.end();}

protected:
	/** Register an MIDIIn object. This is done by the MIDIIn object itself
	 */
	bool Register(MIDIIn& in);

	/** Register an MIDIClocker object. This is done by the MIDIClocker
	 * object itself
	 */
	bool Register(MIDIClocker& cl);

	/** Register an MIDIOut object. This is done by the MIDIOut object itself
	 */
	bool Register(MIDIOut& out);

	/* flag to check if the MIDIManager has been started properly*/
	bool mStarted;
};


};//CLAM

#endif