New URL for NEMO forge!   http://forge.nemo-ocean.eu

Since March 2022 along with NEMO 4.2 release, the code development moved to a self-hosted GitLab.
This present forge is now archived and remained online for history.
Property.pm in vendors/lib/FCM/Context/Make/Share – NEMO

source: vendors/lib/FCM/Context/Make/Share/Property.pm @ 10669

Last change on this file since 10669 was 10669, checked in by nicolasmartin, 5 years ago

Import latest FCM release from Github into the repository for testing

File size: 3.2 KB
Line 
1# ------------------------------------------------------------------------------
2# (C) British Crown Copyright 2006-17 Met Office.
3#
4# This file is part of FCM, tools for managing and building source code.
5#
6# FCM is free software: you can redistribute it and/or modify
7# it under the terms of the GNU General Public License as published by
8# the Free Software Foundation, either version 3 of the License, or
9# (at your option) any later version.
10#
11# FCM is distributed in the hope that it will be useful,
12# but WITHOUT ANY WARRANTY; without even the implied warranty of
13# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# GNU General Public License for more details.
15#
16# You should have received a copy of the GNU General Public License
17# along with FCM. If not, see <http://www.gnu.org/licenses/>.
18# ------------------------------------------------------------------------------
19use strict;
20use warnings;
21# ------------------------------------------------------------------------------
22package FCM::Context::Make::Share::Property;
23use base qw{FCM::Class::HASH};
24
25use constant {
26    CTX_VALUE  => 'FCM::Context::Make::Share::Property::Value',
27    NS_OF_ROOT => q{},
28};
29
30__PACKAGE__->class({ctx_of => '%', id => '$'});
31
32sub get_ctx {
33    $_[0]->get_ctx_of(NS_OF_ROOT);
34}
35
36sub set_ctx {
37    $_[0]->get_ctx_of()->{$_[0]->NS_OF_ROOT} = $_[1];
38}
39
40# ------------------------------------------------------------------------------
41package FCM::Context::Make::Share::Property::Value;
42use base qw{FCM::Class::HASH};
43
44__PACKAGE__->class({inherited => '$', value => '$'});
45
46# ------------------------------------------------------------------------------
471;
48__END__
49
50=head1 NAME
51
52FCM::Context::Make::Share::Property
53
54=head1 SYNOPSIS
55
56    use FCM::Context::Make::Share::Property;
57    $prop = FCM::Context::Make::Share::Property->new(\%attrib);
58
59=head1 DESCRIPTION
60
61Provides a context object to store the property of a named shell command.
62
63=head1 OBJECTS
64
65The classes described below are all sub-classes of
66L<FCM::Class::HASH|FCM::Class::HASH>.
67
68=head2 FCM::Context::Make::Share::Property
69
70This class represents a property. It has the following attributes:
71
72=over 4
73
74=item ctx_of
75
76A HASH to map (keys) the name-spaces to (values) the contexts of this property.
77Expects each context to be an instance of
78L</FCM::Context::Make::Share::Property::Value>.
79
80The context of a simple property is stored in the root (i.e. the empty string)
81name-space.
82
83=item id
84
85The ID of this property.
86
87=back
88
89An instance of FCM::Context::Make::Share::Property has 2 additional methods:
90
91=over 4
92
93=item $instance->get_ctx()
94
95Shorthand for:
96
97    $instance->get_ctx_of(q{}).
98
99=item $instance->set_ctx($ctx)
100
101Shorthand for:
102
103    $instance->get_ctx_of()->{q{}} = $ctx.
104
105=back
106
107=head2 FCM::Context::Make::Share::Property::Value
108
109This class represents a property value (associated with a name-space). It has
110the following attributes:
111
112=over 4
113
114=item inherited
115
116A flag, if true, indicates that this value is inherited.
117
118=item value
119
120The value.
121
122=back
123
124=head1 CONSTANTS
125
126=over 4
127
128=item FCM::Context::Make::Share::Property->NS_OF_ROOT
129
130The root name-space, an empty string.
131
132=back
133
134=head1 COPYRIGHT
135
136(C) Crown copyright Met Office. All rights reserved.
137
138=cut
Note: See TracBrowser for help on using the repository browser.