Browse Source

Remove `std::` prefix everywhere in `src`

master
Krisjanis Rijnieks 10 years ago
parent
commit
0fbfe7174b
  1. 2
      src/Commands/CmdManager.h
  2. 6
      src/MediaServer/DirectoryWatcher.cpp
  3. 6
      src/MediaServer/DirectoryWatcher.h
  4. 80
      src/MediaServer/MediaServer.cpp
  5. 50
      src/MediaServer/MediaServer.h
  6. 8
      src/Sources/BaseSource.cpp
  7. 10
      src/Sources/BaseSource.h
  8. 4
      src/Sources/ImageSource.cpp
  9. 4
      src/Sources/ImageSource.h
  10. 12
      src/Sources/SourceType.h
  11. 2
      src/Sources/VideoSource.cpp
  12. 4
      src/Sources/VideoSource.h
  13. 4
      src/Surfaces/QuadSurface.cpp
  14. 34
      src/Surfaces/SurfaceManager.cpp
  15. 2
      src/Surfaces/SurfaceManager.h
  16. 2
      src/Surfaces/SurfaceManagerGui.cpp
  17. 4
      src/Surfaces/TriangleSurface.cpp
  18. 2
      src/UserInterface/RadioList.cpp
  19. 2
      src/UserInterface/RadioList.h
  20. 26
      src/UserInterface/SourcesEditor.cpp
  21. 22
      src/UserInterface/SourcesEditor.h

2
src/Commands/CmdManager.h

@ -14,7 +14,7 @@ class CmdManager {
void undo();
private:
std::vector <BaseUndoCmd *> cmdStack;
vector <BaseUndoCmd *> cmdStack;
};

6
src/MediaServer/DirectoryWatcher.cpp

@ -11,7 +11,7 @@
namespace ofx {
namespace piMapper {
DirectoryWatcher::DirectoryWatcher(std::string path, int watcherMediaType){
DirectoryWatcher::DirectoryWatcher(string path, int watcherMediaType){
mediaType = watcherMediaType;
// Decide what filter we need depending on media type
if(mediaType == SourceType::SOURCE_TYPE_VIDEO){
@ -20,7 +20,7 @@ DirectoryWatcher::DirectoryWatcher(std::string path, int watcherMediaType){
filter = new ImagePathFilter();
}else{
ofLogFatalError("DirectoryWatcher::DirectoryWatcher", "Unkonwn media type");
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
dirWatcher.registerAllEvents(this);
// For some reason the filters are not working,
@ -35,7 +35,7 @@ DirectoryWatcher::~DirectoryWatcher(){
filter = 0;
}
std::vector <std::string> & DirectoryWatcher::getFilePaths(){
vector <string> & DirectoryWatcher::getFilePaths(){
return filePaths;
}

6
src/MediaServer/DirectoryWatcher.h

@ -52,7 +52,7 @@ class ImagePathFilter : public BasePathFilter {
class DirectoryWatcher {
public:
DirectoryWatcher(std::string path, int watcherMediaType);
DirectoryWatcher(string path, int watcherMediaType);
~DirectoryWatcher();
// TODO make useful stuff with onDirectoryWatcher*
@ -119,7 +119,7 @@ class DirectoryWatcher {
}
// Getters
std::vector <std::string> & getFilePaths();
vector <string> & getFilePaths();
int getMediaType();
// Custom events
@ -132,7 +132,7 @@ class DirectoryWatcher {
private:
ofx::IO::DirectoryWatcherManager dirWatcher;
BasePathFilter * filter;
std::vector <std::string> filePaths;
vector <string> filePaths;
int mediaType;
};

80
src/MediaServer/MediaServer.cpp

@ -31,41 +31,41 @@ int MediaServer::getNumFboSources(){
return fboSources.size();
}
std::vector <std::string> & MediaServer::getImagePaths(){
vector <string> & MediaServer::getImagePaths(){
return imageWatcher.getFilePaths();
}
std::vector <std::string> MediaServer::getImageNames(){
std::vector <std::string> imageNames;
vector <string> MediaServer::getImageNames(){
vector <string> imageNames;
for(int i = 0; i < getNumImages(); i++){
// Split image path
std::vector <std::string> pathParts = ofSplitString(getImagePaths()[i], "/");
vector <string> pathParts = ofSplitString(getImagePaths()[i], "/");
// And get only the last piece
std::string name = pathParts[pathParts.size() - 1];
string name = pathParts[pathParts.size() - 1];
imageNames.push_back(name);
}
return imageNames;
}
std::vector <std::string> MediaServer::getFboSourceNames(){
std::vector <std::string> fboSourceNames;
vector <string> MediaServer::getFboSourceNames(){
vector <string> fboSourceNames;
for(int i = 0; i < fboSources.size(); i++){
fboSourceNames.push_back(fboSources[i]->getName());
}
return fboSourceNames;
}
std::vector <std::string> & MediaServer::getVideoPaths(){
vector <string> & MediaServer::getVideoPaths(){
return videoWatcher.getFilePaths();
}
std::vector <std::string> MediaServer::getVideoNames(){
std::vector <std::string> videoNames;
vector <string> MediaServer::getVideoNames(){
vector <string> videoNames;
for(int i = 0; i < getNumVideos(); i++){
// Split video path
std::vector <std::string> pathParts = ofSplitString(getVideoPaths()[i], "/");
vector <string> pathParts = ofSplitString(getVideoPaths()[i], "/");
// And get only the last piece
std::string name = pathParts[pathParts.size() - 1];
string name = pathParts[pathParts.size() - 1];
videoNames.push_back(name);
}
return videoNames;
@ -80,10 +80,10 @@ BaseSource * MediaServer::loadMedia(string & path, int mediaType){
}else if(mediaType == SourceType::SOURCE_TYPE_FBO){
return loadFboSource(path);
}else{
std::stringstream ss;
stringstream ss;
ss << "Can not load media of unknown type: " << mediaType;
ofLogFatalError("MediaServer") << ss.str();
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
return 0;
}
@ -101,11 +101,11 @@ BaseSource * MediaServer::loadImage(string & path){
// Increase reference count of this source
//referenceCount[path]++;
imageSource->referenceCount++;
std::stringstream refss;
stringstream refss;
refss << "Current reference count for " << path << " = " << imageSource->referenceCount;
ofLogNotice("MediaServer") << refss.str();
// Notify objects registered to onImageLoaded event
std::stringstream ss;
stringstream ss;
ss << "Image " << path << " already loaded";
ofLogNotice("MediaServer") << ss.str();
ofNotifyEvent(onImageLoaded, path, this);
@ -117,7 +117,7 @@ BaseSource * MediaServer::loadImage(string & path){
loadedSources[path] = imageSource;
// Set reference count of this image path to 1
//referenceCount[path] = 1;
std::stringstream refss;
stringstream refss;
refss << "Initialized reference count of " << path << " to " << imageSource->referenceCount;
ofLogNotice("MediaServer") << refss.str();
// Notify objects registered to onImageLoaded event
@ -136,14 +136,14 @@ void MediaServer::unloadImage(string & path){
return;
}
// Reference count 0 or less, unload image
std::stringstream ss;
stringstream ss;
ss << "Removing image " << path;
ofLogNotice("MediaServer") << ss.str();
// Destroy image source
if(loadedSources.count(path)){
ofLogNotice("MediaServer") << "Source count BEFORE image removal: " << loadedSources.size() << endl;
loadedSources[path]->clear();
std::map <std::string, BaseSource *>::iterator it = loadedSources.find(path);
map <string, BaseSource *>::iterator it = loadedSources.find(path);
delete it->second;
loadedSources.erase(it);
ofLogNotice("MediaServer") << "Source count AFTER image removal: " << loadedSources.size() << endl;
@ -151,10 +151,10 @@ void MediaServer::unloadImage(string & path){
return;
}
// Something wrong here, we should be out of the routine by now
std::stringstream failss;
stringstream failss;
failss << "Failed to remove image source: " << path;
ofLogFatalError("MediaServer") << failss.str();
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
BaseSource * MediaServer::loadVideo(string & path){
@ -169,11 +169,11 @@ BaseSource * MediaServer::loadVideo(string & path){
if(isVideoLoaded){
// Increase reference count of this source
videoSource->referenceCount++;
std::stringstream refss;
stringstream refss;
refss << "Current reference count for " << path << " = " << videoSource->referenceCount;
ofLogNotice("MediaServer") << refss.str();
// Notify objects registered to onImageLoaded event
std::stringstream ss;
stringstream ss;
ss << "Video " << path << " already loaded";
ofLogNotice("MediaServer") << ss.str();
ofNotifyEvent(onVideoLoaded, path, this);
@ -185,7 +185,7 @@ BaseSource * MediaServer::loadVideo(string & path){
loadedSources[path] = videoSource;
// Set reference count of this image path to 1
//referenceCount[path] = 1;
std::stringstream refss;
stringstream refss;
refss << "Initialized reference count of " << path << " to " << videoSource->referenceCount;
ofLogNotice("MediaServer") << refss.str();
ofNotifyEvent(onVideoLoaded, path, this);
@ -208,7 +208,7 @@ void MediaServer::unloadVideo(string & path){
if(loadedSources.count(path)){
ofLogNotice("MediaServer") << "Source count before video removal: " << loadedSources.size() << endl;
videoSource->clear();
std::map <std::string, BaseSource *>::iterator it = loadedSources.find(path);
map <string, BaseSource *>::iterator it = loadedSources.find(path);
delete it->second;
loadedSources.erase(it);
ofLogNotice("MediaServer") << "Source count after video removal: " << loadedSources.size() << endl;
@ -216,10 +216,10 @@ void MediaServer::unloadVideo(string & path){
return;
}
// Something wrong here, we should be out of the routine by now
std::stringstream failss;
stringstream failss;
failss << "Failed to remove video source: " << path;
ofLogFatalError("MediaServer") << failss.str();
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
void MediaServer::unloadMedia(string & path){
@ -234,7 +234,7 @@ void MediaServer::unloadMedia(string & path){
}else{
// Oh my god, what to do!? Relax and exit.
ofLogFatalError("MediaServer") << "Attempt to unload media of unknown type";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}else{
ofLogNotice("MediaServer") << "Nothing to unload";
@ -243,7 +243,7 @@ void MediaServer::unloadMedia(string & path){
// Clear all loaded media
void MediaServer::clear(){
typedef std::map <std::string, BaseSource *>::iterator it_type;
typedef map <string, BaseSource *>::iterator it_type;
for(it_type i = loadedSources.begin(); i != loadedSources.end(); i++){
// Do not delete FBO source pointers as they are (and should be) initialized elsewhere
if(i->second->getType() != SourceType::SOURCE_TYPE_FBO){
@ -254,35 +254,35 @@ void MediaServer::clear(){
}
// TODO: getLoadedSourceByPath
BaseSource * MediaServer::getSourceByPath(std::string & mediaPath){
BaseSource * MediaServer::getSourceByPath(string & mediaPath){
if(loadedSources.count(mediaPath)){
return loadedSources[mediaPath];
}
// Source not found, exit with error
std::stringstream ss;
stringstream ss;
ss << "Could not find source by path: " << mediaPath;
ofLogFatalError("MediaServer") << ss.str();
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
std::string MediaServer::getDefaultImageDir(){
string MediaServer::getDefaultImageDir(){
return DEFAULT_IMAGES_DIR;
}
std::string MediaServer::getDefaultVideoDir(){
string MediaServer::getDefaultVideoDir(){
return DEFAULT_VIDEOS_DIR;
}
std::string MediaServer::getDefaultMediaDir(int sourceType){
string MediaServer::getDefaultMediaDir(int sourceType){
if(sourceType == SourceType::SOURCE_TYPE_IMAGE){
return getDefaultImageDir();
}else if(sourceType == SourceType::SOURCE_TYPE_VIDEO){
return getDefaultVideoDir();
}else{
std::stringstream ss;
stringstream ss;
ss << "Could not get default media dir. Unknown source type: " << sourceType;
ofLogFatalError("MediaServer") << ss.str();
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}
@ -299,7 +299,7 @@ void MediaServer::addFboSource(ofx::piMapper::FboSource & fboSource){
fboSources.push_back(&fboSource);
} // addFboSource
BaseSource * MediaServer::loadFboSource(std::string & fboSourceName){
BaseSource * MediaServer::loadFboSource(string & fboSourceName){
ofLogNotice("MediaServer") << "Attempting to load FBO source with name " << fboSourceName;
// Search for FBO source name in our storage
FboSource * source = 0;
@ -331,7 +331,7 @@ BaseSource * MediaServer::loadFboSource(std::string & fboSourceName){
return loadedSources[fboSourceName];
} // loadFboSource
void MediaServer::unloadFboSource(std::string & fboSourceName){
void MediaServer::unloadFboSource(string & fboSourceName){
ofLogNotice("MediaServer") << "Attempt to unload FBO source " << fboSourceName;
// Check if loaded at all
if(!loadedSources.count(fboSourceName)){
@ -349,7 +349,7 @@ void MediaServer::unloadFboSource(std::string & fboSourceName){
ofLogNotice("MediaServer") << fboSourceName << " reference count <= 0, removing from loaded sources";
source->referenceCount = 0;
source->removeAppListeners();
std::map <std::string, BaseSource *>::iterator it = loadedSources.find(fboSourceName);
map <string, BaseSource *>::iterator it = loadedSources.find(fboSourceName);
loadedSources.erase(it);
ofLogNotice("MediaServer") << "Source count after FBO source removal: " << loadedSources.size() << endl;
ofNotifyEvent(onFboSourceUnloaded, fboSourceName, this);

50
src/MediaServer/MediaServer.h

@ -37,11 +37,11 @@ class MediaServer {
int getNumVideos();
int getNumImages();
int getNumFboSources(); // new
std::vector <std::string> & getVideoPaths();
std::vector <std::string> getVideoNames();
std::vector <std::string> & getImagePaths();
std::vector <std::string> getImageNames();
std::vector <std::string> getFboSourceNames(); // new
vector <string> & getVideoPaths();
vector <string> getVideoNames();
vector <string> & getImagePaths();
vector <string> getImageNames();
vector <string> getFboSourceNames(); // new
BaseSource * loadMedia(string & path, int mediaType);
BaseSource * loadImage(string & path);
@ -50,36 +50,36 @@ class MediaServer {
void unloadVideo(string & path);
void unloadMedia(string & path);
void clear(); // Force all loaded source unload
BaseSource * getSourceByPath(std::string & mediaPath);
std::string getDefaultImageDir();
std::string getDefaultVideoDir();
std::string getDefaultMediaDir(int sourceType);
BaseSource * getSourceByPath(string & mediaPath);
string getDefaultImageDir();
string getDefaultVideoDir();
string getDefaultMediaDir(int sourceType);
// Do things with FBO sources
void addFboSource(FboSource & fboSource); // could be called also as register FBO source
BaseSource * loadFboSource(std::string & fboSourceName);
void unloadFboSource(std::string & fboSourceName);
BaseSource * loadFboSource(string & fboSourceName);
void unloadFboSource(string & fboSourceName);
// Custom events, add/remove
ofEvent <std::string> onImageAdded;
ofEvent <std::string> onImageRemoved;
ofEvent <std::string> onVideoAdded;
ofEvent <std::string> onVideoRemoved;
ofEvent <std::string> onFboSourceAdded;
ofEvent <std::string> onFboSourceRemoved;
ofEvent <string> onImageAdded;
ofEvent <string> onImageRemoved;
ofEvent <string> onVideoAdded;
ofEvent <string> onVideoRemoved;
ofEvent <string> onFboSourceAdded;
ofEvent <string> onFboSourceRemoved;
// load/unload
ofEvent <std::string> onImageLoaded;
ofEvent <std::string> onImageUnloaded;
ofEvent <std::string> onVideoLoaded;
ofEvent <std::string> onVideoUnloaded;
ofEvent <std::string> onFboSourceLoaded;
ofEvent <std::string> onFboSourceUnloaded;
ofEvent <string> onImageLoaded;
ofEvent <string> onImageUnloaded;
ofEvent <string> onVideoLoaded;
ofEvent <string> onVideoUnloaded;
ofEvent <string> onFboSourceLoaded;
ofEvent <string> onFboSourceUnloaded;
private:
// Directory Watchers
ofx::piMapper::DirectoryWatcher videoWatcher;
ofx::piMapper::DirectoryWatcher imageWatcher;
std::map <std::string, BaseSource *> loadedSources;
map <string, BaseSource *> loadedSources;
// imageWatcher event listeners
void handleImageAdded(string & path);
void handleImageRemoved(string & path);
@ -108,7 +108,7 @@ class MediaServer {
void removeWatcherListeners();
// FBO source storage before they go to loadedSources
std::vector <FboSource *> fboSources; // FBO source storage
vector <FboSource *> fboSources; // FBO source storage
};
} // namespace piMapper

8
src/Sources/BaseSource.cpp

@ -19,7 +19,7 @@ ofTexture * BaseSource::getTexture(){
return texture;
}
std::string & BaseSource::getName(){
string & BaseSource::getName(){
return name;
}
@ -35,7 +35,7 @@ int BaseSource::getType(){
return type;
}
std::string & BaseSource::getPath(){
string & BaseSource::getPath(){
return path;
}
@ -49,8 +49,8 @@ void BaseSource::init(){
referenceCount = 1; // We have one instance on init
}
void BaseSource::setNameFromPath(std::string & fullPath){
std::vector <string> pathParts;
void BaseSource::setNameFromPath(string & fullPath){
vector <string> pathParts;
//cout << "fullPath: " << fullPath << endl;
pathParts = ofSplitString(fullPath, "/"); // Maybe on win "/" is "\", have to test
//cout << "lastPathPart: " << pathParts[pathParts.size() - 1] << endl;

10
src/Sources/BaseSource.h

@ -14,11 +14,11 @@ class BaseSource {
BaseSource(ofTexture * newTexture); // Only one clean way of passing the texture
~BaseSource();
ofTexture * getTexture();
std::string & getName();
string & getName();
bool isLoadable(); // Maybe the loading features shoud go to a derrived class
bool isLoaded(); // as BaseSourceLoadable
int getType();
std::string & getPath();
string & getPath();
virtual void clear(){}
// TODO: add virtual increaseReferenceCount and decreaseReferenceCount methods
@ -29,10 +29,10 @@ class BaseSource {
void init();
protected:
void setNameFromPath(std::string & fullPath);
void setNameFromPath(string & fullPath);
ofTexture * texture;
std::string name;
std::string path; // This is set only if loadable is true
string name;
string path; // This is set only if loadable is true
bool loadable; // If the source can be loaded from disk like image and video
bool loaded; // Is the source loaded?
int type;

4
src/Sources/ImageSource.cpp

@ -12,7 +12,7 @@ ImageSource::ImageSource(){
ImageSource::~ImageSource(){}
void ImageSource::loadImage(std::string & filePath){
void ImageSource::loadImage(string & filePath){
path = filePath;
//cout << "loading image: " << filePath << endl;
setNameFromPath(filePath);
@ -24,7 +24,7 @@ void ImageSource::loadImage(std::string & filePath){
if(!image->loadImage(filePath)){
#endif
ofLogWarning("ImageSource") << "Could not load image";
//std::exit(EXIT_FAILURE);
//exit(EXIT_FAILURE);
}
#if (OF_VERSION_MAJOR == 0 && OF_VERSION_MINOR >= 9) || OF_VERSION_MAJOR > 0
texture = &image->getTexture();

4
src/Sources/ImageSource.h

@ -10,8 +10,8 @@ class ImageSource : public BaseSource {
public:
ImageSource();
~ImageSource();
std::string & getPath();
void loadImage(std::string & filePath);
string & getPath();
void loadImage(string & filePath);
void clear();
private:
ofImage * image;

12
src/Sources/SourceType.h

@ -17,7 +17,7 @@ class SourceType {
SOURCE_TYPE_NONE, SOURCE_TYPE_IMAGE, SOURCE_TYPE_VIDEO, SOURCE_TYPE_FBO
};
static std::string GetSourceTypeName(int sourceTypeEnum){
static string GetSourceTypeName(int sourceTypeEnum){
if(sourceTypeEnum == SOURCE_TYPE_IMAGE){
return SOURCE_TYPE_NAME_IMAGE;
}else if(sourceTypeEnum == SOURCE_TYPE_VIDEO){
@ -27,14 +27,14 @@ class SourceType {
}else if(sourceTypeEnum == SOURCE_TYPE_FBO){
return SOURCE_TYPE_NAME_FBO;
}else{
std::stringstream ss;
stringstream ss;
ss << "Invalid source type: " << sourceTypeEnum;
ofLogFatalError("SourceType") << ss.str();
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}
static int GetSourceTypeEnum(std::string sourceTypeName){
static int GetSourceTypeEnum(string sourceTypeName){
if(sourceTypeName == SOURCE_TYPE_NAME_IMAGE){
return SOURCE_TYPE_IMAGE;
}else if(sourceTypeName == SOURCE_TYPE_NAME_VIDEO){
@ -44,10 +44,10 @@ class SourceType {
}else if(sourceTypeName == SOURCE_TYPE_NAME_FBO){
return SOURCE_TYPE_FBO;
}else{
std::stringstream ss;
stringstream ss;
ss << "Invalid source type name: " << sourceTypeName;
ofLogFatalError("SourceType") << ss.str();
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}

2
src/Sources/VideoSource.cpp

@ -18,7 +18,7 @@ VideoSource::VideoSource(){
VideoSource::~VideoSource(){}
void VideoSource::loadVideo(std::string & filePath){
void VideoSource::loadVideo(string & filePath){
path = filePath;
setNameFromPath(filePath);
#ifdef TARGET_RASPBERRY_PI

4
src/Sources/VideoSource.h

@ -21,8 +21,8 @@ class VideoSource : public BaseSource {
VideoSource();
~VideoSource();
std::string & getPath();
void loadVideo(std::string & path);
string & getPath();
void loadVideo(string & path);
void clear();
#ifndef TARGET_RASPBERRY_PI

4
src/Surfaces/QuadSurface.cpp

@ -141,7 +141,7 @@ bool QuadSurface::hitTest(ofVec2f p){
ofVec2f QuadSurface::getVertex(int index){
if(index > 3){
ofLog() << "Vertex with this index does not exist: " << index << endl;
throw std::runtime_error("Vertex index out of bounds.");
throw runtime_error("Vertex index out of bounds.");
}
ofVec3f vert = mesh.getVertex(index);
@ -150,7 +150,7 @@ ofVec2f QuadSurface::getVertex(int index){
ofVec2f QuadSurface::getTexCoord(int index){
if(index > 3){
throw std::runtime_error("Texture coordinate index out of bounds.");
throw runtime_error("Texture coordinate index out of bounds.");
}
return mesh.getTexCoord(index);

34
src/Surfaces/SurfaceManager.cpp

@ -25,7 +25,7 @@ void SurfaceManager::addSurface(int surfaceType){
surfaces.push_back(new QuadSurface());
}else{
ofLogFatalError("SurfaceManager") << "Attempt to add non-existing surface type";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}
@ -38,7 +38,7 @@ void SurfaceManager::addSurface(int surfaceType, BaseSource * newSource){
surfaces.back()->setSource(newSource);
}else{
ofLogFatalError("SurfaceManager") << "Attempt to add non-existing surface type";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}
@ -46,10 +46,10 @@ void SurfaceManager::addSurface(int surfaceType, vector <ofVec2f> vertices,
vector <ofVec2f> texCoords){
if(surfaceType == SurfaceType::TRIANGLE_SURFACE){
if(vertices.size() < 3){
throw std::runtime_error(
throw runtime_error(
"There must be 3 vertices for a triangle surface.");
}else if(texCoords.size() < 3){
throw std::runtime_error(
throw runtime_error(
"There must be 3 texture coordinates for a triangle surface.");
}
@ -62,9 +62,9 @@ void SurfaceManager::addSurface(int surfaceType, vector <ofVec2f> vertices,
}else if(surfaceType == SurfaceType::QUAD_SURFACE){
if(vertices.size() < 4){
throw std::runtime_error("There must be 4 vertices for a quad surface.");
throw runtime_error("There must be 4 vertices for a quad surface.");
}else if(texCoords.size() < 4){
throw std::runtime_error(
throw runtime_error(
"There must be 4 texture coordinates for a quad surface.");
}
@ -76,7 +76,7 @@ void SurfaceManager::addSurface(int surfaceType, vector <ofVec2f> vertices,
}
}else{
ofLogFatalError("SurfaceManager") << "Attempt to add non-existing surface type";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}
@ -85,10 +85,10 @@ void SurfaceManager::addSurface(int surfaceType, BaseSource * newSource,
vector <ofVec2f> texCoords){
if(surfaceType == SurfaceType::TRIANGLE_SURFACE){
if(vertices.size() < 3){
throw std::runtime_error(
throw runtime_error(
"There must be 3 vertices for a triangle surface.");
}else if(texCoords.size() < 3){
throw std::runtime_error(
throw runtime_error(
"Thre must be 3 texture coordinates for a triangle surface.");
}
@ -102,9 +102,9 @@ void SurfaceManager::addSurface(int surfaceType, BaseSource * newSource,
}else if(surfaceType == SurfaceType::QUAD_SURFACE){
if(vertices.size() < 4){
throw std::runtime_error("There must be 4 vertices for a quad surface.");
throw runtime_error("There must be 4 vertices for a quad surface.");
}else if(texCoords.size() < 4){
throw std::runtime_error(
throw runtime_error(
"Thre must be 4 texture coordinates for a quad surface.");
}
@ -117,7 +117,7 @@ void SurfaceManager::addSurface(int surfaceType, BaseSource * newSource,
}
}else{
ofLogFatalError("SurfaceManager") << "Attempt to add non-existing surface type";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
}
@ -162,7 +162,7 @@ void SurfaceManager::saveXmlSettings(string fileName){
// Exit if mediaServer not set
if(mediaServer == 0){
ofLogFatalError("SurfaceManager") << "Media server not set";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
// We need a fresh copy of the xml settings object
xmlSettings.clear();
@ -219,7 +219,7 @@ void SurfaceManager::loadXmlSettings(string fileName){
// Exit if there is no media server
if(mediaServer == 0){
ofLogFatalError("SurfaceManager") << "Media server not set";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
if(!xmlSettings.loadFile(fileName)){
ofLogWarning("SurfaceManager") << "Could not load XML settings";
@ -249,7 +249,7 @@ void SurfaceManager::loadXmlSettings(string fileName){
}else{
// Construct full path
string dir = mediaServer->getDefaultMediaDir(typeEnum);
std::stringstream pathss;
stringstream pathss;
pathss << ofToDataPath(dir, true) << sourceName;
string sourcePath = pathss.str();
// Load media by using full path
@ -383,7 +383,7 @@ void SurfaceManager::setMediaServer(MediaServer * newMediaServer){
BaseSurface * SurfaceManager::selectSurface(int index){
if(index >= surfaces.size()){
throw std::runtime_error("Surface index out of bounds.");
throw runtime_error("Surface index out of bounds.");
}
selectedSurface = surfaces[index];
@ -414,7 +414,7 @@ void SurfaceManager::deselectSurface(){
BaseSurface * SurfaceManager::getSurface(int index){
if(index >= surfaces.size()){
throw std::runtime_error("Surface index out of bounds.");
throw runtime_error("Surface index out of bounds.");
return 0;
}

2
src/Surfaces/SurfaceManager.h

@ -52,7 +52,7 @@ class SurfaceManager {
void deselectSurface();
private:
std::vector <BaseSurface *> surfaces;
vector <BaseSurface *> surfaces;
BaseSurface * selectedSurface;
ofxXmlSettings xmlSettings;
MediaServer * mediaServer;

2
src/Surfaces/SurfaceManagerGui.cpp

@ -248,7 +248,7 @@ void SurfaceManagerGui::setMode(int newGuiMode){
if(newGuiMode != GuiMode::NONE && newGuiMode != GuiMode::TEXTURE_MAPPING &&
newGuiMode != GuiMode::PROJECTION_MAPPING &&
newGuiMode != GuiMode::SOURCE_SELECTION){
throw std::runtime_error("Trying to set invalid mode.");
throw runtime_error("Trying to set invalid mode.");
}
if(newGuiMode == GuiMode::NONE){

4
src/Surfaces/TriangleSurface.cpp

@ -98,7 +98,7 @@ bool TriangleSurface::hitTest(ofVec2f p){
ofVec2f TriangleSurface::getVertex(int index){
if(index > 2){
ofLog() << "Vertex with this index does not exist: " << index << endl;
throw std::runtime_error("Vertex index out of bounds.");
throw runtime_error("Vertex index out of bounds.");
}
ofVec3f vert = mesh.getVertex(index);
@ -107,7 +107,7 @@ ofVec2f TriangleSurface::getVertex(int index){
ofVec2f TriangleSurface::getTexCoord(int index){
if(index > 2){
throw std::runtime_error("Texture coordinate index out of bounds.");
throw runtime_error("Texture coordinate index out of bounds.");
}
return mesh.getTexCoord(index);

2
src/UserInterface/RadioList.cpp

@ -85,7 +85,7 @@ void RadioList::selectItem(int index){
storedSelectedItem = index;
}
bool RadioList::selectItemByValue(std::string itemValue){
bool RadioList::selectItemByValue(string itemValue){
if(itemValue == ""){
ofLogNotice("RadioList") << "Item value empty";
return false;

2
src/UserInterface/RadioList.h

@ -22,7 +22,7 @@ class RadioList {
void setPosition(ofPoint p);
void setPosition(float x, float y);
void selectItem(int index);
bool selectItemByValue(std::string itemValue);
bool selectItemByValue(string itemValue);
void enable();
void disable();
void clear();

26
src/UserInterface/SourcesEditor.cpp

@ -66,7 +66,7 @@ void SourcesEditor::setup(ofEventArgs & args){
ofAddListener(videoSelector->onRadioSelected, this, &SourcesEditor::handleVideoSelected);
}
if(numFbos){
std::vector <std::string> fboNames = mediaServer->getFboSourceNames();
vector <string> fboNames = mediaServer->getFboSourceNames();
fboSelector->setup("FBOs", fboNames, fboNames);
ofAddListener(fboSelector->onRadioSelected, this, &SourcesEditor::handleFboSelected);
}
@ -157,7 +157,7 @@ void SourcesEditor::setMediaServer(MediaServer * newMediaServer){
if(newMediaServer == 0){
// Log an error and return from the routine
ofLogFatalError("SourcesEditor") << "New media server is 0";
std::exit(EXIT_FAILURE);
exit(EXIT_FAILURE);
}
// Attempt to clear existing media server and assign new one
clearMediaServer();
@ -167,7 +167,7 @@ void SourcesEditor::setMediaServer(MediaServer * newMediaServer){
isMediaServerExternal = true;
}
void SourcesEditor::selectSourceRadioButton(std::string & sourcePath){
void SourcesEditor::selectSourceRadioButton(string & sourcePath){
if(sourcePath == ""){
ofLogNotice("SourcesEditor") << "Path is empty";
if(imageSelector->size()){
@ -358,16 +358,16 @@ void SourcesEditor::clearMediaServer(){
}
}
void SourcesEditor::handleImageAdded(std::string & path){}
void SourcesEditor::handleImageRemoved(std::string & path){}
void SourcesEditor::handleVideoAdded(std::string & path){}
void SourcesEditor::handleVideoRemoved(std::string & path){}
void SourcesEditor::handleImageLoaded(std::string & path){}
void SourcesEditor::handleImageUnloaded(std::string & path){}
void SourcesEditor::handleFboSourceAdded(std::string & name){}
void SourcesEditor::handleFboSourceRemoved(std::string & name){}
void SourcesEditor::handleFboSourceLoaded(std::string & name){}
void SourcesEditor::handleFboSourceUnloaded(std::string & name){}
void SourcesEditor::handleImageAdded(string & path){}
void SourcesEditor::handleImageRemoved(string & path){}
void SourcesEditor::handleVideoAdded(string & path){}
void SourcesEditor::handleVideoRemoved(string & path){}
void SourcesEditor::handleImageLoaded(string & path){}
void SourcesEditor::handleImageUnloaded(string & path){}
void SourcesEditor::handleFboSourceAdded(string & name){}
void SourcesEditor::handleFboSourceRemoved(string & name){}
void SourcesEditor::handleFboSourceLoaded(string & name){}
void SourcesEditor::handleFboSourceUnloaded(string & name){}
} // namespace piMapper
} // namespace ofx

22
src/UserInterface/SourcesEditor.h

@ -35,7 +35,7 @@ class SourcesEditor {
// Sets external MediaServer
void setMediaServer(MediaServer * newMediaServer);
//void selectImageSourceRadioButton(string name);
void selectSourceRadioButton(std::string & sourcePath);
void selectSourceRadioButton(string & sourcePath);
int getLoadedTexCount();
ofTexture * getTexture(int index);
@ -74,16 +74,16 @@ class SourcesEditor {
void clearMediaServer();
// MediaServer event handlers
void handleImageAdded(std::string & path);
void handleImageRemoved(std::string & path);
void handleVideoAdded(std::string & path);
void handleVideoRemoved(std::string & path);
void handleImageLoaded(std::string & path);
void handleImageUnloaded(std::string & path);
void handleFboSourceAdded(std::string & name);
void handleFboSourceRemoved(std::string & name);
void handleFboSourceLoaded(std::string & name);
void handleFboSourceUnloaded(std::string & name);
void handleImageAdded(string & path);
void handleImageRemoved(string & path);
void handleVideoAdded(string & path);
void handleVideoRemoved(string & path);
void handleImageLoaded(string & path);
void handleImageUnloaded(string & path);
void handleFboSourceAdded(string & name);
void handleFboSourceRemoved(string & name);
void handleFboSourceLoaded(string & name);
void handleFboSourceUnloaded(string & name);
};

Loading…
Cancel
Save