MBDyn-1.7.3
Main Page
Modules
Namespaces
Classes
Files
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
socketstreamdrive.h
Go to the documentation of this file.
1
/* $Header: /var/cvs/mbdyn/mbdyn/mbdyn-1.0/mbdyn/base/socketstreamdrive.h,v 1.37 2017/09/09 09:18:21 masarati Exp $ */
2
/*
3
* MBDyn (C) is a multibody analysis code.
4
* http://www.mbdyn.org
5
*
6
* Copyright (C) 1996-2017
7
*
8
* Pierangelo Masarati <masarati@aero.polimi.it>
9
* Paolo Mantegazza <mantegazza@aero.polimi.it>
10
*
11
* Dipartimento di Ingegneria Aerospaziale - Politecnico di Milano
12
* via La Masa, 34 - 20156 Milano, Italy
13
* http://www.aero.polimi.it
14
*
15
* Changing this copyright notice is forbidden.
16
*
17
* This program is free software; you can redistribute it and/or modify
18
* it under the terms of the GNU General Public License as published by
19
* the Free Software Foundation (version 2 of the License).
20
*
21
*
22
* This program is distributed in the hope that it will be useful,
23
* but WITHOUT ANY WARRANTY; without even the implied warranty of
24
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
* GNU General Public License for more details.
26
*
27
* You should have received a copy of the GNU General Public License
28
* along with this program; if not, write to the Free Software
29
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30
*/
31
32
/*
33
* Author: Michele Attolico <attolico@aero.polimi.it>
34
*/
35
36
/* socket driver */
37
38
#ifndef SOCKETSTREAMDRIVE_H
39
#define SOCKETSTREAMDRIVE_H
40
41
#include "
streamdrive.h
"
42
43
#ifdef USE_SOCKET
44
45
#include "
usesock.h
"
46
47
/* SocketStreamDrive - begin */
48
49
class
SocketStreamDrive :
public
StreamDrive
{
50
protected
:
51
unsigned
int
InputEvery;
52
bool
bReceiveFirst;
53
unsigned
int
InputCounter;
54
55
UseSocket *pUS;
56
int
recv_flags;
57
struct
timeval SocketTimeout;
58
59
StreamDriveEcho
*pSDE;
60
61
public
:
62
SocketStreamDrive(
unsigned
int
uL,
63
const
DriveHandler
* pDH,
64
UseSocket *pUS,
bool
c
,
65
const
std::string& sFileName,
66
integer
nd,
const
std::vector<doublereal>&
v0
,
67
StreamDrive::Modifier
*pMod,
68
unsigned
int
ie,
bool
bReceiveFirst,
69
int
flags,
70
const
struct
timeval& st,
71
StreamDriveEcho
*pSDE);
72
73
virtual
~SocketStreamDrive(
void
);
74
75
/* Scrive il contributo del DriveCaller al file di restart */
76
virtual
std::ostream&
Restart
(std::ostream& out)
const
;
77
78
virtual
void
ServePending
(
const
doublereal
& t);
79
};
80
81
/* SocketStreamDrive - end */
82
83
#endif // USE_SOCKET
84
85
class
DataManager
;
86
class
MBDynParser
;
87
88
struct
StreamDR
:
public
DriveRead
{
89
private
:
90
std::string
s
;
91
92
public
:
93
StreamDR
(
void
) {
NO_OP
; };
94
StreamDR
(
const
std::string &
s
) : s(s) {
NO_OP
; };
95
96
virtual
Drive
*
97
Read
(
unsigned
uLabel,
const
DataManager
*pDM,
MBDynParser
& HP);
98
};
99
100
/* Luca Conti edits - GSOC 2017 */
101
102
/* file drive content type reader: every content type must inherit
103
from this struct and implement its own Read method */
104
struct
FileDriveContentTypeReader
{
105
virtual
StreamDrive::Modifier
*
Read
(std::vector<doublereal> &
v0
,
MBDynParser
& HP,
int
&idrives) = 0;
106
virtual
~FileDriveContentTypeReader
(
void
) {
NO_OP
; };
107
};
108
/* bag of content-type readers - every content type is registered inside
109
of it by using SetFileDriveContentType(...) */
110
typedef
std::map<std::string,FileDriveContentTypeReader*>
FileDriveContentTypeMap
;
111
extern
FileDriveContentTypeMap
fileDriveContentTypeMap
;
112
113
struct
FileDriveContentTypeWordSetType
:
public
HighParser::WordSet
{
114
virtual
bool
IsWord
(
const
std::string& s)
const
;
115
};
116
extern
FileDriveContentTypeWordSetType
fileDriveContentTypeWordSet
;
117
118
/* registration function: call it to register a new content type */
119
bool
SetFileDriveContentType
(
const
char
*name,
FileDriveContentTypeReader
*rf);
120
121
/* deallocation of all content types in fileDriveContentTypeMap, if any was added */
122
void
DestroyFileDriveContentTypes
(
void
);
123
124
#endif
/* SOCKETSTREAMDRIVE_H */
FileDriveContentTypeWordSetType::IsWord
virtual bool IsWord(const std::string &s) const
Definition:
socketstreamdrive.cc:661
FileDriveContentTypeReader
Definition:
socketstreamdrive.h:104
DriveRead
Definition:
drive.h:718
StreamDrive
Definition:
streamdrive.h:42
fileDriveContentTypeWordSet
FileDriveContentTypeWordSetType fileDriveContentTypeWordSet
Definition:
socketstreamdrive.cc:657
DriveHandler
Definition:
drive.h:171
StreamDR::s
std::string s
Definition:
socketstreamdrive.h:90
FileDrive::Restart
virtual std::ostream & Restart(std::ostream &out) const =0
Drive
Definition:
drive.h:89
StreamDR::StreamDR
StreamDR(const std::string &s)
Definition:
socketstreamdrive.h:94
StreamDrive::Modifier
Definition:
streamdrive.h:44
Drive::ServePending
virtual void ServePending(const doublereal &t)=0
NO_OP
#define NO_OP
Definition:
myassert.h:74
fileDriveContentTypeMap
FileDriveContentTypeMap fileDriveContentTypeMap
Definition:
socketstreamdrive.cc:656
DataManager
Definition:
dataman.h:85
DestroyFileDriveContentTypes
void DestroyFileDriveContentTypes(void)
Definition:
socketstreamdrive.cc:673
StreamDR::StreamDR
StreamDR(void)
Definition:
socketstreamdrive.h:93
FileDriveContentTypeWordSetType
Definition:
socketstreamdrive.h:113
MBDynParser
Definition:
mbpar.h:129
StreamDriveEcho
Definition:
streamdrive.h:90
SetFileDriveContentType
bool SetFileDriveContentType(const char *name, FileDriveContentTypeReader *rf)
Definition:
socketstreamdrive.cc:666
StreamDR::Read
virtual Drive * Read(unsigned uLabel, const DataManager *pDM, MBDynParser &HP)
Definition:
socketstreamdrive.cc:622
usesock.h
FileDriveContentTypeReader::~FileDriveContentTypeReader
virtual ~FileDriveContentTypeReader(void)
Definition:
socketstreamdrive.h:106
FileDriveContentTypeMap
std::map< std::string, FileDriveContentTypeReader * > FileDriveContentTypeMap
Definition:
socketstreamdrive.h:110
HighParser::WordSet
Definition:
parser.h:309
StreamDR
Definition:
socketstreamdrive.h:88
c
static std::stack< cleanup * > c
Definition:
cleanup.cc:59
streamdrive.h
FileDriveContentTypeReader::Read
virtual StreamDrive::Modifier * Read(std::vector< doublereal > &v0, MBDynParser &HP, int &idrives)=0
v0
static const std::vector< doublereal > v0
Definition:
fixedstep.cc:45
doublereal
double doublereal
Definition:
colamd.c:52
integer
long int integer
Definition:
colamd.c:51
mbdyn
base
socketstreamdrive.h
Generated on Fri Apr 13 2018 10:19:37 for MBDyn-1.7.3 by
1.8.7