Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
WCCL
Manage
Activity
Members
Labels
Plan
Issues
4
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Analysers
WCCL
Commits
b67ecdd0
Commit
b67ecdd0
authored
14 years ago
by
Adam Wardynski
Browse files
Options
Downloads
Patches
Plain Diff
Reworking DefaultFunction a bit, putting const.
parent
e01ab872
Branches
Branches containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
libwccl/ops/functions/conditional.h
+8
-4
8 additions, 4 deletions
libwccl/ops/functions/conditional.h
libwccl/ops/functions/constant.h
+1
-1
1 addition, 1 deletion
libwccl/ops/functions/constant.h
libwccl/ops/operator.h
+2
-2
2 additions, 2 deletions
libwccl/ops/operator.h
with
11 additions
and
7 deletions
libwccl/ops/functions/conditional.h
+
8
−
4
View file @
b67ecdd0
...
...
@@ -17,13 +17,13 @@ namespace Wccl {
template
<
class
T
>
class
Conditional
:
public
Function
<
T
>
{
public:
typedef
boost
::
shared_ptr
<
Function
<
T
>
>
ArgFunctionPtr
;
typedef
boost
::
shared_ptr
<
Function
<
Bool
>
>
BoolFunctionPtr
;
typedef
boost
::
shared_ptr
<
const
Function
<
T
>
>
ArgFunctionPtr
;
typedef
boost
::
shared_ptr
<
const
Function
<
Bool
>
>
BoolFunctionPtr
;
Conditional
(
const
BoolFunctionPtr
&
cond_expr
,
const
ArgFunctionPtr
&
iftrue_expr
,
const
ArgFunctionPtr
&
iffalse_expr
=
detail
::
DefaultFunction
<
T
>
())
const
ArgFunctionPtr
&
iffalse_expr
=
Default
())
:
cond_expr_
(
cond_expr
),
iftrue_expr_
(
iftrue_expr
),
iffalse_expr_
(
iffalse_expr
)
{
BOOST_ASSERT
(
cond_expr_
);
...
...
@@ -69,6 +69,10 @@ protected:
}
return
iffalse_expr_
->
apply
(
context
);
}
private
:
static
const
ArgFunctionPtr
Default
()
{
return
detail
::
DefaultFunction
<
T
>
();
}
};
/**
...
...
@@ -82,7 +86,7 @@ template<class T>
class
ConditionalOp
:
public
Conditional
<
T
>
{
public:
typedef
typename
Conditional
<
T
>::
ArgFunctionPtr
ArgFunctionPtr
;
typedef
boost
::
shared_ptr
<
Function
<
Bool
>
>
BoolFunctionPtr
;
typedef
typename
Conditional
<
T
>::
BoolFunctionPtr
BoolFunctionPtr
;
ConditionalOp
(
const
BoolFunctionPtr
&
cond_expr
,
...
...
This diff is collapsed.
Click to expand it.
libwccl/ops/functions/constant.h
+
1
−
1
View file @
b67ecdd0
...
...
@@ -68,7 +68,7 @@ namespace detail {
* that is returning default Value of given type T.
*/
template
<
class
T
>
static
boost
::
shared_ptr
<
Function
<
T
>
>
DefaultFunction
()
{
static
const
boost
::
shared_ptr
<
const
Function
<
T
>
>
DefaultFunction
()
{
static
boost
::
shared_ptr
<
Function
<
T
>
>
default_fun
(
new
Constant
<
T
>
((
T
())));
return
default_fun
;
}
...
...
This diff is collapsed.
Click to expand it.
libwccl/ops/operator.h
+
2
−
2
View file @
b67ecdd0
...
...
@@ -53,7 +53,7 @@ template <class T>
class
Operator
:
public
FunctionalOperator
{
public:
Operator
(
const
boost
::
shared_ptr
<
Function
<
T
>
>&
body
,
const
Variables
&
variables
);
Operator
(
const
boost
::
shared_ptr
<
const
Function
<
T
>
>&
body
,
const
Variables
&
variables
);
/**
* Applies the functional operator to given sentence context.
...
...
@@ -209,7 +209,7 @@ protected:
Operator
*
clone_internal
()
const
;
private:
boost
::
shared_ptr
<
Function
<
T
>
>
function_body_
;
boost
::
shared_ptr
<
Function
<
const
T
>
>
function_body_
;
};
//--- implementation details ---
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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