Page Menu
Home
HEPForge
Search
Configure Global Search
Log In
Files
F8309613
FROG_Element_Base_With_DetId_And_Name.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Subscribers
None
FROG_Element_Base_With_DetId_And_Name.h
View Options
// FROG_Element_Base_With_DetId.h: base class for all modules (which contains a method DetId()
// WARNING : Class heriting from FROG_Element_Base_With_DetId are responsible for saving/loading detId_
// Loading and writting function of FROG_Element_Base_With_DetId are usefull only to make
// a group of daughters (branchs) with a detId.
//////////////////////////////////////////////////////////////////////
#ifndef _FROG_ELEMENT_BASE_WITH_DETID_AND_NAME_H__
#define _FROG_ELEMENT_BASE_WITH_DETID_AND_NAME__H__
#include
"FROG_Element_Base_With_DetId.h"
class
FROG_Element_Base_With_DetId_And_Name
:
public
FROG_Element_Base_With_DetId
{
protected
:
unsigned
short
NameLength_
;
public
:
char
*
Name_
;
public
:
virtual
bool
isCompactible
(){
return
false
;
}
static
unsigned
int
sizeOf
()
{
return
6
+
sizeof
(
unsigned
int
)
+
sizeof
(
unsigned
short
);}
FROG_Element_Base_With_DetId_And_Name
()
:
FROG_Element_Base_With_DetId
(
C_FEB_DETID_NAME
){}
FROG_Element_Base_With_DetId_And_Name
(
unsigned
int
detId
,
const
char
*
name
,
...)
:
FROG_Element_Base_With_DetId
(
C_FEB_DETID_NAME
,
detId
){
char
FullName
[
512
];
va_list
args
;
va_start
(
args
,
name
);
vsprintf
(
FullName
,
name
,
args
);
va_end
(
args
);
size_
=
sizeOf
();
NameLength_
=
strlen
(
FullName
);
Name_
=
new
char
[
NameLength_
+
1
];
strcpy
(
Name_
,
FullName
);
Name_
[
NameLength_
]
=
'\0'
;
size_
+=
NameLength_
*
sizeof
(
char
);
}
~
FROG_Element_Base_With_DetId_And_Name
()
{
delete
[]
Name_
;}
unsigned
int
read
(
FILE
*
pFile
,
unsigned
int
toRead
=
0
){
unsigned
int
read
=
0
;
read
+=
fread
(
&
detId_
,
1
,
sizeof
(
detId_
)
,
pFile
);
read
+=
fread
(
&
NameLength_
,
1
,
sizeof
(
NameLength_
),
pFile
);
Name_
=
new
char
[
NameLength_
+
1
];
read
+=
fread
(
Name_
,
1
,
NameLength_
*
sizeof
(
char
),
pFile
);
Name_
[
NameLength_
]
=
'\0'
;
return
read
;
}
// Fill data_ and size_ with data
virtual
void
write
(){
std
::
vector
<
std
::
pair
<
unsigned
int
,
unsigned
int
>
>*
blockOfDaughters
=
write_init
();
data_
=
FillBuffer
(
data_
,
&
detId_
,
sizeof
(
detId_
));
// write the type
data_
=
FillBuffer
(
data_
,
&
NameLength_
,
sizeof
(
NameLength_
));
data_
=
FillBuffer
(
data_
,
Name_
,
NameLength_
*
sizeof
(
char
));
write_daughters
(
blockOfDaughters
);
}
const
char
*
Name
(){
return
Name_
;}
};
#endif
File Metadata
Details
Attached
Mime Type
text/x-c++
Expires
Sat, Dec 21, 3:56 PM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4019927
Default Alt Text
FROG_Element_Base_With_DetId_And_Name.h (2 KB)
Attached To
rFROGSVN frogsvn
Event Timeline
Log In to Comment