Commit 6c9d0dda authored by Oliver Heidmann's avatar Oliver Heidmann
Browse files

added function for getting a reference to a module_t instance, added module_t...

added function for getting a reference to a module_t instance, added module_t member to process_t, removed dependency to argument_t in pstreamOpenReadFile() and createFileList()
parent dab49ca6
......@@ -1421,3 +1421,9 @@ void get_original(char * operatorName)
Error("%s is not an alias", operatorName);
}
}
modules_t &getModule(const std::string &operator_name)
{
return modules[get_module_name_to(operator_name)];
}
......@@ -17,6 +17,7 @@
#ifndef MODULES_H
#define MODULES_H
#include <iostream>
#include <map>
#include <stdbool.h>
......@@ -60,6 +61,8 @@ static std::map<std::string, std::string> aliases;
void *(*operatorModule(std::string operatorName))(void *);
void *(*operatorModule(const char *operatorName))(void *);
modules_t &getModule(const std::string &operatorName);
void init_modules();
void init_aliases();
......
......@@ -782,6 +782,8 @@ processDefArgument(void *vargument)
processDefPrompt(process.operatorName);
process.module = getModule(process.operatorName);
setStreams(argc, argv);
}
......
......@@ -22,8 +22,10 @@
#include <vector>
#include "util.h"
#include "pstream.h"
#include "modules.h"
#include <vector>
#include <iostream>
constexpr int MAX_PROCESS = 128;
constexpr int MAX_STREAM = 64;
......@@ -70,6 +72,8 @@ class process_t {
short noper;
oper_t oper[MAX_OPERATOR];
modules_t module;
int getInStreamCnt();
int getOutStreamCnt();
void initProcess();
......@@ -77,7 +81,9 @@ class process_t {
process_t(int ID);
private:
process_t();
void OpenRead(int p_input_idx);
void OpenWrite(int p_input_idx);
void OpenAppend(int p_input_idx);
};
pstream_t* processInqInputStream(int streamindex);
......@@ -115,4 +121,5 @@ const char *processInqOpername2(int processID);
const char *processInqPrompt(void);
const argument_t *cdoStreamName(int cnt);
#endif /* _PROCESS_H */
......@@ -389,9 +389,7 @@ pstream_t::pstreamOpenReadPipe(const argument_t *argument)
createPipeName(pipename, pnlen);
// struct sched_param param;
argument_t *newargument = new argument_t();
newargument->argc = argument->argc + 1;
newargument->argv = (char **) Malloc(newargument->argc * sizeof(char *));
argument_t *newargument = argument_new(argument->argc + 1, argument->argc *sizeof(char *));
newargument->operatorName = "";
memcpy(newargument->argv, argument->argv, argument->argc * sizeof(char *));
......
......@@ -23,6 +23,7 @@
#include "argument.h"
#include <sys/types.h> /* off_t */
#include <vector>
class pstream_t
{
......@@ -34,12 +35,13 @@ public:
void defTimestep(int p_tsID);
bool isPipe();
void pstreamOpenReadPipe(const argument_t *argument);
void pstreamOpenReadFile(const argument_t *argument);
void pstreamOpenReadFile(const char *argument);
void openAppend(const char * p_filename);
void init();
void defVlist(int p_vlistID);
void close();
int self; //aka the id of the pstream
std::pair<int, int> m_id;
int mode;
int m_fileID;
int m_vlistID;
......@@ -60,7 +62,7 @@ public:
pthread_t rthreadID; /* read thread ID */
pthread_t wthreadID; /* write thread ID */
private:
void createFilelist(const argument_t * p_argument);
void createFilelist(const char *p_args);
pstream_t();
void createPipeName(char *pipename, int pnlen);
void defVarList(int vlistID);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment