Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
libcdi
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mpim-sw
libcdi
Commits
4e1f8b4d
Commit
4e1f8b4d
authored
8 years ago
by
Thomas Jahns
Committed by
Sergey Kosukhin
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Use symbolic constants instead of counter.
parent
b8472c46
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/taxis.c
+80
-56
80 additions, 56 deletions
src/taxis.c
with
80 additions
and
56 deletions
src/taxis.c
+
80
−
56
View file @
4e1f8b4d
...
...
@@ -1429,7 +1429,29 @@ taxisTxCode(void *taxisptr)
enum
{
taxisNint
=
22
TAXIS_PACK_INT_SELF
,
TAXIS_PACK_INT_USED
,
TAXIS_PACK_INT_TYPE
,
TAXIS_PACK_INT_VDATE
,
TAXIS_PACK_INT_VTIME
,
TAXIS_PACK_INT_RDATE
,
TAXIS_PACK_INT_RTIME
,
TAXIS_PACK_INT_FDATE
,
TAXIS_PACK_INT_FTIME
,
TAXIS_PACK_INT_CALENDAR
,
TAXIS_PACK_INT_UNIT
,
TAXIS_PACK_INT_FC_UNIT
,
TAXIS_PACK_INT_NUMAVG
,
TAXIS_PACK_INT_CLIMATOLOGY
,
TAXIS_PACK_INT_HAS_BOUNDS
,
TAXIS_PACK_INT_VDATE_LB
,
TAXIS_PACK_INT_VDATE_UB
,
TAXIS_PACK_INT_VTIME_LB
,
TAXIS_PACK_INT_VTIME_UB
,
TAXIS_PACK_INT_NAMELEN
,
TAXIS_PACK_INT_LNAMELEN
,
TAXIS_PACK_INT_UNITSLEN
,
taxisNint
};
static
int
...
...
@@ -1446,10 +1468,10 @@ taxisGetPackSize(void *p, void *context)
int
taxisUnpack
(
char
*
unpackBuffer
,
int
unpackBufferSize
,
int
*
unpackBufferPos
,
int
originNamespace
,
void
*
context
,
int
force_id
)
{
#define adaptKey(key) (namespaceAdaptKey((key), originNamespace))
taxis_t
*
taxisP
;
int
intBuffer
[
taxisNint
];
uint32_t
d
;
int
idx
=
0
;
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
intBuffer
,
taxisNint
,
CDI_DATATYPE_INT
,
context
);
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
&
d
,
1
,
CDI_DATATYPE_UINT32
,
context
);
...
...
@@ -1458,50 +1480,49 @@ taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int
taxisInit
();
cdiResH
targetID
=
namespaceA
daptKey
(
intBuffer
[
idx
++
],
originNamespace
)
;
taxisP
=
taxisNewEntry
(
force_id
?
targetID
:
CDI_UNDEF
ID
);
cdiResH
targetID
=
force_id
?
a
daptKey
(
intBuffer
[
TAXIS_PACK_INT_SELF
])
:
CDI_UNDEFID
;
taxisP
=
taxisNewEntry
(
target
ID
);
xassert
(
!
force_id
||
targetID
==
taxisP
->
self
);
taxisP
->
used
=
(
short
)
intBuffer
[
idx
++
];
taxisP
->
type
=
intBuffer
[
idx
++
];
taxisP
->
vDateTime
.
date
=
cdiDate_set
(
intBuffer
[
idx
++
]);
taxisP
->
vDateTime
.
time
=
cdiTime_set
(
intBuffer
[
idx
++
]);
taxisP
->
rDateTime
.
date
=
cdiDate_set
(
intBuffer
[
idx
++
]);
taxisP
->
rDateTime
.
time
=
cdiTime_set
(
intBuffer
[
idx
++
]);
taxisP
->
fDateTime
.
date
=
cdiDate_set
(
intBuffer
[
idx
++
]);
taxisP
->
fDateTime
.
time
=
cdiTime_set
(
intBuffer
[
idx
++
]);
taxisP
->
calendar
=
intBuffer
[
idx
++
];
taxisP
->
unit
=
intBuffer
[
idx
++
];
taxisP
->
fc_unit
=
intBuffer
[
idx
++
];
taxisP
->
numavg
=
intBuffer
[
idx
++
];
taxisP
->
climatology
=
intBuffer
[
idx
++
];
taxisP
->
has_bounds
=
(
short
)
intBuffer
[
idx
++
];
taxisP
->
vDateTime_lb
.
date
=
cdiDate_set
(
intBuffer
[
idx
++
]);
taxisP
->
vDateTime_lb
.
time
=
cdiTime_set
(
intBuffer
[
idx
++
]);
taxisP
->
vDateTime_ub
.
date
=
cdiDate_set
(
intBuffer
[
idx
++
]);
taxisP
->
vDateTime_ub
.
time
=
cdiTime_set
(
intBuffer
[
idx
++
]);
if
(
intBuffer
[
idx
])
taxisP
->
used
=
(
short
)
intBuffer
[
TAXIS_PACK_INT_USED
];
taxisP
->
type
=
intBuffer
[
TAXIS_PACK_INT_TYPE
];
taxisP
->
vDateTime
.
date
=
cdiDate_set
(
intBuffer
[
TAXIS_PACK_INT_VDATE
]);
taxisP
->
vDateTime
.
time
=
cdiTime_set
(
intBuffer
[
TAXIS_PACK_INT_VTIME
]);
taxisP
->
rDateTime
.
date
=
cdiDate_set
(
intBuffer
[
TAXIS_PACK_INT_RDATE
]);
taxisP
->
rDateTime
.
time
=
cdiTime_set
(
intBuffer
[
TAXIS_PACK_INT_RTIME
]);
taxisP
->
fDateTime
.
date
=
cdiDate_set
(
intBuffer
[
TAXIS_PACK_INT_FDATE
]);
taxisP
->
fDateTime
.
time
=
cdiTime_set
(
intBuffer
[
TAXIS_PACK_INT_FTIME
]);
taxisP
->
calendar
=
intBuffer
[
TAXIS_PACK_INT_CALENDAR
];
taxisP
->
unit
=
intBuffer
[
TAXIS_PACK_INT_UNIT
];
taxisP
->
fc_unit
=
intBuffer
[
TAXIS_PACK_INT_FC_UNIT
];
taxisP
->
numavg
=
intBuffer
[
TAXIS_PACK_INT_NUMAVG
];
taxisP
->
climatology
=
intBuffer
[
TAXIS_PACK_INT_CLIMATOLOGY
];
taxisP
->
has_bounds
=
(
short
)
intBuffer
[
TAXIS_PACK_INT_HAS_BOUNDS
];
taxisP
->
vDateTime_lb
.
date
=
cdiDate_set
(
intBuffer
[
TAXIS_PACK_INT_VDATE_LB
]);
taxisP
->
vDateTime_lb
.
time
=
cdiTime_set
(
intBuffer
[
TAXIS_PACK_INT_VDATE_UB
]);
taxisP
->
vDateTime_ub
.
date
=
cdiDate_set
(
intBuffer
[
TAXIS_PACK_INT_VTIME_LB
]);
taxisP
->
vDateTime_ub
.
time
=
cdiTime_set
(
intBuffer
[
TAXIS_PACK_INT_VTIME_UB
]);
if
(
intBuffer
[
TAXIS_PACK_INT_NAMELEN
])
{
int
len
=
intBuffer
[
idx
];
int
len
=
intBuffer
[
TAXIS_PACK_INT_NAMELEN
];
char
*
name
=
new_refcount_string
((
size_t
)
len
);
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
name
,
len
,
CDI_DATATYPE_TXT
,
context
);
name
[
len
]
=
'\0'
;
taxisP
->
name
=
name
;
}
idx
++
;
if
(
intBuffer
[
idx
])
if
(
intBuffer
[
TAXIS_PACK_INT_LNAMELEN
])
{
int
len
=
intBuffer
[
idx
];
int
len
=
intBuffer
[
TAXIS_PACK_INT_LNAMELEN
];
char
*
longname
=
new_refcount_string
((
size_t
)
len
);
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
longname
,
len
,
CDI_DATATYPE_TXT
,
context
);
longname
[
len
]
=
'\0'
;
taxisP
->
longname
=
longname
;
}
if
(
intBuffer
[
idx
])
if
(
intBuffer
[
TAXIS_PACK_INT_UNITSLEN
])
{
int
len
=
intBuffer
[
idx
];
int
len
=
intBuffer
[
TAXIS_PACK_INT_UNITSLEN
];
char
*
units
=
new_refcount_string
((
size_t
)
len
);
serializeUnpack
(
unpackBuffer
,
unpackBufferSize
,
unpackBufferPos
,
units
,
len
,
CDI_DATATYPE_TXT
,
context
);
units
[
len
]
=
'\0'
;
...
...
@@ -1509,6 +1530,7 @@ taxisUnpack(char *unpackBuffer, int unpackBufferSize, int *unpackBufferPos, int
}
reshSetStatus
(
taxisP
->
self
,
&
taxisOps
,
reshGetStatus
(
taxisP
->
self
,
&
taxisOps
)
&
~
RESH_SYNC_BIT
);
#undef adaptKey
return
taxisP
->
self
;
}
...
...
@@ -1519,39 +1541,41 @@ taxisPack(void *voidP, void *packBuffer, int packBufferSize, int *packBufferPos,
taxis_t
*
taxisP
=
(
taxis_t
*
)
voidP
;
int
intBuffer
[
taxisNint
];
int
idx
=
0
;
intBuffer
[
idx
++
]
=
taxisP
->
self
;
intBuffer
[
idx
++
]
=
taxisP
->
used
;
intBuffer
[
idx
++
]
=
taxisP
->
type
;
intBuffer
[
idx
++
]
=
(
int
)
cdiDate_get
(
taxisP
->
vDateTime
.
date
);
intBuffer
[
idx
++
]
=
cdiTime_get
(
taxisP
->
vDateTime
.
time
);
intBuffer
[
idx
++
]
=
(
int
)
cdiDate_get
(
taxisP
->
rDateTime
.
date
);
intBuffer
[
idx
++
]
=
cdiTime_get
(
taxisP
->
rDateTime
.
time
);
intBuffer
[
idx
++
]
=
(
int
)
cdiDate_get
(
taxisP
->
fDateTime
.
date
);
intBuffer
[
idx
++
]
=
cdiTime_get
(
taxisP
->
fDateTime
.
time
);
intBuffer
[
idx
++
]
=
taxisP
->
calendar
;
intBuffer
[
idx
++
]
=
taxisP
->
unit
;
intBuffer
[
idx
++
]
=
taxisP
->
fc_unit
;
intBuffer
[
idx
++
]
=
taxisP
->
numavg
;
intBuffer
[
idx
++
]
=
taxisP
->
climatology
;
intBuffer
[
idx
++
]
=
taxisP
->
has_bounds
;
intBuffer
[
idx
++
]
=
(
int
)
cdiDate_get
(
taxisP
->
vDateTime_lb
.
date
);
intBuffer
[
idx
++
]
=
cdiTime_get
(
taxisP
->
vDateTime_lb
.
time
);
intBuffer
[
idx
++
]
=
(
int
)
cdiDate_get
(
taxisP
->
vDateTime_ub
.
date
);
intBuffer
[
idx
++
]
=
cdiTime_get
(
taxisP
->
vDateTime_ub
.
time
);
intBuffer
[
idx
++
]
=
taxisP
->
name
?
(
int
)
strlen
(
taxisP
->
name
)
:
0
;
intBuffer
[
idx
++
]
=
taxisP
->
longname
?
(
int
)
strlen
(
taxisP
->
longname
)
:
0
;
intBuffer
[
idx
++
]
=
taxisP
->
units
?
(
int
)
strlen
(
taxisP
->
units
)
:
0
;
intBuffer
[
TAXIS_PACK_INT_SELF
]
=
taxisP
->
self
;
intBuffer
[
TAXIS_PACK_INT_USED
]
=
taxisP
->
used
;
intBuffer
[
TAXIS_PACK_INT_TYPE
]
=
taxisP
->
type
;
intBuffer
[
TAXIS_PACK_INT_VDATE
]
=
(
int
)
cdiDate_get
(
taxisP
->
vDateTime
.
date
);
intBuffer
[
TAXIS_PACK_INT_VTIME
]
=
cdiTime_get
(
taxisP
->
vDateTime
.
time
);
intBuffer
[
TAXIS_PACK_INT_RDATE
]
=
(
int
)
cdiDate_get
(
taxisP
->
rDateTime
.
date
);
intBuffer
[
TAXIS_PACK_INT_RTIME
]
=
cdiTime_get
(
taxisP
->
rDateTime
.
time
);
intBuffer
[
TAXIS_PACK_INT_FDATE
]
=
(
int
)
cdiDate_get
(
taxisP
->
fDateTime
.
date
);
intBuffer
[
TAXIS_PACK_INT_FTIME
]
=
cdiTime_get
(
taxisP
->
fDateTime
.
time
);
intBuffer
[
TAXIS_PACK_INT_CALENDAR
]
=
taxisP
->
calendar
;
intBuffer
[
TAXIS_PACK_INT_UNIT
]
=
taxisP
->
unit
;
intBuffer
[
TAXIS_PACK_INT_FC_UNIT
]
=
taxisP
->
fc_unit
;
intBuffer
[
TAXIS_PACK_INT_NUMAVG
]
=
taxisP
->
numavg
;
intBuffer
[
TAXIS_PACK_INT_CLIMATOLOGY
]
=
taxisP
->
climatology
;
intBuffer
[
TAXIS_PACK_INT_HAS_BOUNDS
]
=
taxisP
->
has_bounds
;
intBuffer
[
TAXIS_PACK_INT_VDATE_LB
]
=
(
int
)
cdiDate_get
(
taxisP
->
vDateTime_lb
.
date
);
intBuffer
[
TAXIS_PACK_INT_VDATE_UB
]
=
cdiTime_get
(
taxisP
->
vDateTime_lb
.
time
);
intBuffer
[
TAXIS_PACK_INT_VTIME_LB
]
=
(
int
)
cdiDate_get
(
taxisP
->
vDateTime_ub
.
date
);
intBuffer
[
TAXIS_PACK_INT_VTIME_UB
]
=
cdiTime_get
(
taxisP
->
vDateTime_ub
.
time
);
intBuffer
[
TAXIS_PACK_INT_NAMELEN
]
=
taxisP
->
name
?
(
int
)
strlen
(
taxisP
->
name
)
:
0
;
intBuffer
[
TAXIS_PACK_INT_LNAMELEN
]
=
taxisP
->
longname
?
(
int
)
strlen
(
taxisP
->
longname
)
:
0
;
intBuffer
[
TAXIS_PACK_INT_UNITSLEN
]
=
taxisP
->
units
?
(
int
)
strlen
(
taxisP
->
units
)
:
0
;
serializePack
(
intBuffer
,
taxisNint
,
CDI_DATATYPE_INT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
uint32_t
d
=
cdiCheckSum
(
CDI_DATATYPE_INT
,
taxisNint
,
intBuffer
);
serializePack
(
&
d
,
1
,
CDI_DATATYPE_UINT32
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
if
(
taxisP
->
name
)
serializePack
(
taxisP
->
name
,
intBuffer
[
15
],
CDI_DATATYPE_TXT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
serializePack
(
taxisP
->
name
,
intBuffer
[
TAXIS_PACK_INT_NAMELEN
],
CDI_DATATYPE_TXT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
if
(
taxisP
->
longname
)
serializePack
(
taxisP
->
longname
,
intBuffer
[
16
],
CDI_DATATYPE_TXT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
serializePack
(
taxisP
->
longname
,
intBuffer
[
TAXIS_PACK_INT_LNAMELEN
],
CDI_DATATYPE_TXT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
if
(
taxisP
->
units
)
serializePack
(
taxisP
->
units
,
intBuffer
[
16
],
CDI_DATATYPE_TXT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
serializePack
(
taxisP
->
units
,
intBuffer
[
TAXIS_PACK_INT_UNITSLEN
],
CDI_DATATYPE_TXT
,
packBuffer
,
packBufferSize
,
packBufferPos
,
context
);
}
/*
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment