Renamed several dirs, files and classes. NOT TESTED.

- renamed imp_client/ to clients/ and ditto for servers/
- renamed imp/ to servers/
- renamed stream/input.h to stream/stream.h
- renamed Stream::InputStream to Stream::Stream
- updated various tests and makefiles
- NOT TESTED YET
actorid
Nicolay Korslund 15 years ago
parent eedf0c9e3b
commit 69e8f9c9db

@ -4,7 +4,7 @@
#include <string>
#include <stdint.h>
#include "../stream/input.h"
#include "../stream/stream.h"
namespace Mangle {
namespace Sound {
@ -73,7 +73,7 @@ class InputManager
virtual InputSource *load(const std::string &file) = 0;
/// Load a sound input source from stream (if canLoadStream is true)
virtual InputSource *load(Stream::InputStream *input) = 0;
virtual InputSource *load(Stream::Stream *input) = 0;
/// Virtual destructor
virtual ~InputManager() {}

@ -20,7 +20,7 @@ class AudiereManager : public Manager
virtual Sound *load(const std::string &file, bool stream=false);
/// not implemented yet
virtual Sound *load(Stream::InputStream *input, bool stream=false)
virtual Sound *load(Stream::Stream *input, bool stream=false)
{ assert(0); }
/// disabled

@ -1,7 +1,7 @@
#include "input_audiere.h"
#include <assert.h>
#include "../../stream/imp_client/audiere_file.h"
#include "../../stream/clients/audiere_file.h"
// Exception handling
class Audiere_Exception : public std::exception
@ -33,7 +33,7 @@ AudiereInput::AudiereInput()
InputSource *AudiereInput::load(const std::string &file)
{ return new AudiereSource(file); }
InputSource *AudiereInput::load(Stream::InputStream *input)
InputSource *AudiereInput::load(Stream::Stream *input)
{ return new AudiereSource(input); }
// --- InputSource ---
@ -47,7 +47,7 @@ AudiereSource::AudiereSource(const std::string &file)
buf = CreateSampleBuffer(sample);
}
AudiereSource::AudiereSource(Stream::InputStream *input)
AudiereSource::AudiereSource(Stream::Stream *input)
{
SampleSourcePtr sample = OpenSampleSource
(new Stream::AudiereFile(input));

@ -18,7 +18,7 @@ class AudiereInput : public InputManager
InputSource *load(const std::string &file);
/// Load a source from a stream
virtual InputSource *load(Stream::InputStream *input);
virtual InputSource *load(Stream::Stream *input);
};
/// Audiere InputSource implementation
@ -28,7 +28,7 @@ class AudiereSource : public InputSource
public:
AudiereSource(const std::string &file);
AudiereSource(Stream::InputStream *input);
AudiereSource(Stream::Stream *input);
InputStream *getStream();
void drop() { delete this; }
};

@ -37,7 +37,7 @@ class FFM_InputManager : public InputManager
virtual InputSource *load(const std::string &file);
/// not supported
virtual InputSource *load(Stream::InputStream *input) { assert(0); }
virtual InputSource *load(Stream::Stream *input) { assert(0); }
};
/// FFMpeg implementation of InputSource

@ -63,7 +63,7 @@ class InputFilter : public Manager
virtual Sound *load(const std::string &file, bool stream=false)
{ return load(inp->load(file), stream); }
virtual Sound *load(Stream::InputStream *input, bool stream=false)
virtual Sound *load(Stream::Stream *input, bool stream=false)
{ return load(inp->load(input), stream); }
virtual Sound *load(InputSource *input, bool stream=false)

@ -98,7 +98,7 @@ OpenAL_Manager::~OpenAL_Manager()
Sound *OpenAL_Manager::load(const std::string &file, bool stream)
{ assert(0 && "OpenAL cannot decode files"); }
Sound *OpenAL_Manager::load(Stream::InputStream*,bool)
Sound *OpenAL_Manager::load(Stream::Stream*,bool)
{ assert(0 && "OpenAL cannot decode streams"); }
Sound *OpenAL_Manager::load(InputSource *source, bool stream)

@ -26,7 +26,7 @@ public:
void remove_stream(LST::iterator);
virtual Sound *load(const std::string &file, bool stream=false);
virtual Sound *load(Stream::InputStream *input, bool stream=false);
virtual Sound *load(Stream::Stream *input, bool stream=false);
virtual Sound *load(InputSource* input, bool stream=false);
virtual void update();
virtual void setListenerPos(float x, float y, float z,

@ -4,7 +4,7 @@
#include <string>
#include "input.h"
#include "../stream/input.h"
#include "../stream/stream.h"
namespace Mangle {
namespace Sound {
@ -145,7 +145,7 @@ class Manager
@param stream true if the file should be streamed
@see load(InputSource*,bool)
*/
virtual Sound *load(Stream::InputStream *input, bool stream=false) = 0;
virtual Sound *load(Stream::Stream *input, bool stream=false) = 0;
/**
@brief Load a sound directly from file. Only valid if canLoadFile

@ -1,4 +1,4 @@
GCC=g++ -I../ -I../imp/
GCC=g++ -I../
all: audiere_test ffmpeg_openal_test openal_audiere_test
@ -6,13 +6,13 @@ L_FFMPEG=$(shell pkg-config --libs libavcodec libavformat)
L_OPENAL=$(shell pkg-config --libs openal)
L_AUDIERE=-laudiere
ffmpeg_openal_test: ffmpeg_openal_test.cpp ../imp/input_ffmpeg.cpp ../imp/output_openal.cpp
ffmpeg_openal_test: ffmpeg_openal_test.cpp ../servers/input_ffmpeg.cpp ../servers/output_openal.cpp
$(GCC) $^ -o $@ $(L_FFMPEG) $(L_OPENAL)
openal_audiere_test: openal_audiere_test.cpp ../imp/input_audiere.cpp ../imp/output_openal.cpp ../../stream/imp_client/audiere_file.cpp
openal_audiere_test: openal_audiere_test.cpp ../servers/input_audiere.cpp ../servers/output_openal.cpp ../../stream/clients/audiere_file.cpp
$(GCC) $^ -o $@ $(L_AUDIERE) $(L_OPENAL)
audiere_test: audiere_test.cpp ../imp/audiere_imp.cpp
audiere_test: audiere_test.cpp ../servers/audiere_imp.cpp
$(GCC) $^ -o $@ $(L_AUDIERE)
clean:

@ -6,7 +6,7 @@
using namespace std;
class TestStream : public Mangle::Stream::InputStream
class TestStream : public Mangle::Stream::Stream
{
ifstream io;

@ -13,11 +13,11 @@ namespace Stream {
This lets Audiere read sound files from any generic archive or
file manager that supports Mangle streams.
*/
class AudiereFile : public audiere::RefImplementation<audiere::File>, _IWrapper
class AudiereFile : public audiere::RefImplementation<audiere::File>, _SWrapper
{
public:
AudiereFile(InputStream *inp, bool autoDel=false)
: _IWrapper(inp, autoDel) {}
AudiereFile(Stream *inp, bool autoDel=false)
: _SWrapper(inp, autoDel) {}
/// Read 'count' bytes, return bytes successfully read
int read(void *buf, int count)

@ -1,29 +1,29 @@
#ifndef MANGLE_STREAM_IWRAPPER_H
#define MANGLE_STREAM_IWRAPPER_H
#include "../input.h"
#include "../stream.h"
#include <assert.h>
namespace Mangle {
namespace Stream {
/** A generic wrapper class for a Stream::Input object.
/** A generic wrapper class for a Stream::Stream object.
This is used by other implementations.
*/
class _IWrapper
class _SWrapper
{
private:
bool autoDel;
protected:
InputStream *inp;
Stream *inp;
public:
_IWrapper(InputStream *_inp, bool _autoDel = false)
_SWrapper(Stream *_inp, bool _autoDel = false)
: inp(_inp), autoDel(_autoDel) { assert(inp != NULL); }
virtual ~_IWrapper() { if(autoDel) delete inp; }
virtual ~_SWrapper() { if(autoDel) delete inp; }
};
}} // namespaces

@ -14,7 +14,7 @@ namespace Stream {
to make your own modifications if you're working with newer (or
older) versions.
*/
class MangleDataStream : public Ogre::DataStream, _IWrapper
class MangleDataStream : public Ogre::DataStream, _SWrapper
{
void init()
{
@ -25,12 +25,12 @@ class MangleDataStream : public Ogre::DataStream, _IWrapper
public:
/// Constructor without name
MangleDataStream(InputStream *inp, bool autoDel=false)
: _IWrapper(inp, autoDel) { init(); }
MangleDataStream(Stream *inp, bool autoDel=false)
: _SWrapper(inp, autoDel) { init(); }
/// Constructor for a named data stream
MangleDataStream(const Ogre::String &name, InputStream *inp, bool autoDel=false)
: _IWrapper(inp, autoDel), Ogre::DataStream(name) { init(); }
MangleDataStream(const Ogre::String &name, Stream *inp, bool autoDel=false)
: _SWrapper(inp, autoDel), Ogre::DataStream(name) { init(); }
// Only implement the DataStream functions we have to implement

@ -12,7 +12,7 @@ namespace Stream {
to make your own modifications if you're working with newer (or
older) versions.
*/
class OgreStream : public InputStream
class OgreStream : public Stream
{
Ogre::DataStreamPtr inp;

@ -7,7 +7,7 @@ namespace Mangle {
namespace Stream {
/// A Stream wrapping a PHYSFS_file stream from the PhysFS library.
class PhysFile : public InputStream
class PhysFile : public Stream
{
PHYSFS_file *file;

@ -7,7 +7,7 @@ namespace Mangle {
namespace Stream {
/// An abstract interface for a stream data.
class InputStream
class Stream
{
public:
// Feature options. These should be set in the constructor.
@ -22,7 +22,7 @@ class InputStream
bool hasSize;
/// Virtual destructor
virtual ~InputStream() {}
virtual ~Stream() {}
/** Read a given number of bytes from the stream. Returns the actual
number read. If the return value is less than count, then the

@ -1,4 +1,4 @@
GCC=g++ -I../ -I../imp_client/
GCC=g++ -I../
all: ogre_client_test dummy_test audiere_client_test
@ -6,13 +6,13 @@ I_OGRE=$(shell pkg-config --cflags OGRE)
L_OGRE=$(shell pkg-config --libs OGRE)
L_AUDIERE=-laudiere
ogre_client_test: ogre_client_test.cpp dummy_input.cpp ../input.h ../imp_client/iwrapper.h ../imp_client/ogre_datastream.h
ogre_client_test: ogre_client_test.cpp dummy_input.cpp ../stream.h ../clients/iwrapper.h ../clients/ogre_datastream.h
$(GCC) $< -o $@ $(I_OGRE) $(L_OGRE)
audiere_client_test: audiere_client_test.cpp dummy_input.cpp ../input.h ../imp_client/iwrapper.h ../imp_client/audiere_file.h ../imp_client/audiere_file.cpp
$(GCC) $< -o $@ ../imp_client/audiere_file.cpp $(L_AUDIERE)
audiere_client_test: audiere_client_test.cpp dummy_input.cpp ../stream.h ../clients/iwrapper.h ../clients/audiere_file.h ../clients/audiere_file.cpp
$(GCC) $< -o $@ ../clients/audiere_file.cpp $(L_AUDIERE)
dummy_test: dummy_test.cpp dummy_input.cpp ../input.h
dummy_test: dummy_test.cpp dummy_input.cpp ../stream.h
$(GCC) $< -o $@
clean:

@ -1,5 +1,5 @@
#include "dummy_input.cpp"
#include "../imp_client/audiere_file.h"
#include "../clients/audiere_file.h"
#include <audiere.h>
#include <iostream>
@ -10,7 +10,7 @@ int main()
{
char str[12];
memset(str, 0, 12);
InputStream *inp = new DummyInput();
Stream *inp = new DummyInput();
FilePtr p(new AudiereFile(inp, true));
cout << "pos=" << p->tell() << endl;
p->read(str, 2);

@ -1,5 +1,5 @@
// This file is shared between several test programs
#include "../input.h"
#include "../stream.h"
#include <assert.h>
#include <string.h>
@ -8,7 +8,7 @@ using namespace Mangle::Stream;
// A simple dummy stream
const char _data[12] = "hello world";
class DummyInput : public InputStream
class DummyInput : public Stream
{
private:
int pos;

@ -7,7 +7,7 @@ using namespace std;
int main()
{
InputStream *inp = new DummyInput();
Stream *inp = new DummyInput();
cout << "Size: " << inp->size() << endl;
cout << "Pos: " << inp->tell() << "\nSeeking...\n";

@ -7,7 +7,7 @@ using namespace std;
int main()
{
InputStream *inp = new DummyInput();
Stream *inp = new DummyInput();
DataStreamPtr p(new MangleDataStream("hello", inp, true));
cout << "Name: " << p->getName() << endl;
cout << "As string: " << p->getAsString() << endl;

@ -7,7 +7,7 @@ L_OGRE=$(shell pkg-config --libs OGRE)
L_OPENAL=$(shell pkg-config --libs openal)
L_AUDIERE=-laudiere
ogrevfs_audiere_openal_test: ogrevfs_audiere_openal_test.cpp ../vfs/imp_server/ogre_vfs.cpp ../sound/imp/input_audiere.cpp ../sound/imp/output_openal.cpp ../stream/imp_client/audiere_file.cpp
ogrevfs_audiere_openal_test: ogrevfs_audiere_openal_test.cpp ../vfs/servers/ogre_vfs.cpp ../sound/servers/input_audiere.cpp ../sound/servers/output_openal.cpp ../stream/clients/audiere_file.cpp
$(GCC) $^ -o $@ $(I_OGRE) $(L_OGRE) $(L_OPENAL) $(L_AUDIERE)
clean:

@ -7,8 +7,8 @@
*/
#include "sound/imp/openal_audiere.h"
#include "vfs/imp_server/ogre_vfs.h"
#include "sound/servers/openal_audiere.h"
#include "vfs/servers/ogre_vfs.h"
#include <Ogre.h>
#include <iostream>

@ -1,6 +1,6 @@
#include "ogre_archive.h"
#include "../../stream/imp_client/ogre_datastream.h"
#include "../../stream/clients/ogre_datastream.h"
using namespace Mangle::VFS;
using namespace Mangle::Stream;

@ -1,5 +1,5 @@
#include "ogre_vfs.h"
#include "../../stream/imp_server/ogre_datastream.h"
#include "../../stream/servers/ogre_datastream.h"
using namespace Mangle::VFS;
@ -18,7 +18,7 @@ OgreVFS::OgreVFS(const std::string &_group)
group = gm->getWorldResourceGroupName();
}
Mangle::Stream::InputStream *OgreVFS::open(const std::string &name)
Mangle::Stream::Stream *OgreVFS::open(const std::string &name)
{
Ogre::DataStreamPtr data = gm->openResource(name, group);
return new Stream::OgreStream(data);

@ -36,7 +36,7 @@ class OgreVFS : public VFS
/// Open a new data stream. Deleting the object should be enough to
/// close it.
virtual Stream::InputStream *open(const std::string &name);
virtual Stream::Stream *open(const std::string &name);
/// Check for the existence of a file
virtual bool isFile(const std::string &name) const

@ -2,7 +2,7 @@
#define MANGLE_VFS_PHYSFS_SERVER_H
#include "../vfs.h"
#include "../../stream/imp_server/phys_stream.h"
#include "../../stream/servers/phys_stream.h"
#include <physfs.h>
#include <assert.h>
@ -26,7 +26,7 @@ class PhysVFS : public VFS
/// Open a new data stream. Deleting the object should be enough to
/// close it.
virtual Stream::InputStream *open(const std::string &name)
virtual Stream::Stream *open(const std::string &name)
{ return new Stream::PhysFile(PHYSFS_openRead(name.c_str())); }
/// Check for the existence of a file

@ -6,16 +6,16 @@ I_OGRE=$(shell pkg-config --cflags OGRE)
L_OGRE=$(shell pkg-config --libs OGRE)
L_PHYSFS=-lphysfs
ogre_client_test: ogre_client_test.cpp dummy_vfs.cpp ../vfs.h ../imp_client/wrapper.h ../imp_client/ogre_archive.h ../imp_client/ogre_archive.cpp
$(GCC) $< ../imp_client/ogre_archive.cpp -o $@ $(I_OGRE) $(L_OGRE)
ogre_client_test: ogre_client_test.cpp dummy_vfs.cpp ../vfs.h ../clients/wrapper.h ../clients/ogre_archive.h ../clients/ogre_archive.cpp
$(GCC) $< ../clients/ogre_archive.cpp -o $@ $(I_OGRE) $(L_OGRE)
ogre_resource_test: ogre_resource_test.cpp
$(GCC) $< -o $@ $(I_OGRE) $(L_OGRE)
ogre_server_test: ogre_server_test.cpp ../vfs.h ../imp_server/ogre_vfs.h ../imp_server/ogre_vfs.cpp
$(GCC) $< -o $@ $(I_OGRE) $(L_OGRE) ../imp_server/ogre_vfs.cpp
ogre_server_test: ogre_server_test.cpp ../vfs.h ../servers/ogre_vfs.h ../servers/ogre_vfs.cpp
$(GCC) $< -o $@ $(I_OGRE) $(L_OGRE) ../servers/ogre_vfs.cpp
physfs_server_test: physfs_server_test.cpp ../vfs.h ../imp_server/physfs_vfs.h
physfs_server_test: physfs_server_test.cpp ../vfs.h ../servers/physfs_vfs.h
$(GCC) $< -o $@ $(L_PHYSFS)
dummy_test: dummy_test.cpp dummy_vfs.cpp ../vfs.h

@ -33,7 +33,7 @@ int main()
cout << endl;
print(vfs.stat("dir"));
InputStream *inp = vfs.open("file1");
Stream *inp = vfs.open("file1");
cout << "filesize: " << inp->size() << endl;
return 0;

@ -17,7 +17,7 @@ public:
}
// We only support opening 'file1' at the moment.
Mangle::Stream::InputStream *open(const std::string &name)
Mangle::Stream::Stream *open(const std::string &name)
{
assert(name == "file1");
return new DummyInput();

@ -1,5 +1,5 @@
#include "dummy_vfs.cpp"
#include "../imp_client/ogre_archive.h"
#include "../clients/ogre_archive.h"
#include <iostream>
using namespace Ogre;

@ -1,4 +1,4 @@
#include "../imp_server/ogre_vfs.h"
#include "../servers/ogre_vfs.h"
#include <Ogre.h>

@ -1,4 +1,4 @@
#include "../imp_server/physfs_vfs.h"
#include "../servers/physfs_vfs.h"
#include "server_common.cpp"

@ -14,7 +14,7 @@ void find(VFS &vfs, const std::string &file)
return;
}
InputStream *data = vfs.open(file);
Stream *data = vfs.open(file);
cout << "Size: " << data->size() << endl;

@ -1,7 +1,7 @@
#ifndef MANGLE_VFS_H
#define MANGLE_VFS_H
#include "../stream/input.h"
#include "../stream/stream.h"
#include <string>
#include <vector>
@ -51,7 +51,7 @@ class VFS
/// Open a new data stream. Deleting the object should be enough to
/// close it.
virtual Stream::InputStream *open(const std::string &name) = 0;
virtual Stream::Stream *open(const std::string &name) = 0;
/// Check for the existence of a file
virtual bool isFile(const std::string &name) const = 0;

Loading…
Cancel
Save