Commit 41794e7d authored by Christopher Reis's avatar Christopher Reis

Delete GMSEC folders

parent d18a7e8d
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# GMSECAPI.pm
#
# Description: GMSEC API constants
#
##############################################################################
BEGIN {
use Config;
if (!$Config{usethreads})
{
print STDERR "ERROR: in order to use GMSEC, perl must be compiled with threads\n";
exit 1;
}
}
package GMSECAPI;
use strict;
use GMSECAPI::Status;
use GMSECAPI::Field;
use GMSECAPI::Message;
use GMSECAPI::Config;
use GMSECAPI::ConnectionFactory;
use GMSECAPI::Connection;
use GMSECAPI::Callback;
use GMSECAPI::ConfigFile;
use base qw(DynaLoader Exporter);
bootstrap GMSECAPI;
use vars qw(@EXPORT);
@EXPORT = qw( $GMSEC_CONNECTION_ICSSWB
$GMSEC_CONNECTION_RENDEZVOUS
$GMSEC_CONNECTION_SMARTSOCKETS
$GMSEC_TYPE_UNSET
$GMSEC_TYPE_CHAR
$GMSEC_TYPE_BOOL
$GMSEC_TYPE_SHORT
$GMSEC_TYPE_USHORT
$GMSEC_TYPE_LONG
$GMSEC_TYPE_ULONG
$GMSEC_TYPE_FLOAT
$GMSEC_TYPE_DOUBLE
$GMSEC_TYPE_STRING
$GMSEC_TYPE_BIN
$GMSEC_TYPE_I8
$GMSEC_TYPE_U8
$GMSEC_TYPE_I16
$GMSEC_TYPE_U16
$GMSEC_TYPE_I32
$GMSEC_TYPE_U32
$GMSEC_TYPE_I64
$GMSEC_TYPE_F32
$GMSEC_TYPE_F64
$GMSEC_TRUE
$GMSEC_FALSE
$GMSEC_MSG_UNSET
$GMSEC_MSG_PUBLISH
$GMSEC_MSG_REQUEST
$GMSEC_MSG_REPLY
$GMSEC_NO_WAIT
$GMSEC_WAIT_FOREVER
$NULL
$GMSEC_STATUS_NO_ERROR
$GMSEC_STATUS_FACTORY_ERROR
$GMSEC_STATUS_CONNECTION_ERROR
$GMSEC_STATUS_CONFIG_ERROR
$GMSEC_STATUS_MIDDLEWARE_ERROR
$GMSEC_STATUS_MESSAGE_ERROR
$GMSEC_STATUS_FIELD_ERROR
$GMSEC_STATUS_CALLBACK_ERROR
$GMSEC_STATUS_CALLBACKLKP_ERROR
$GMSEC_LIBRARY_LOAD_FAILURE
$GMSEC_INVALID_CONNECTION_TYPE
$GMSEC_AUTODISPATCH_FAILURE
$GMSEC_INVALID_CONNECTION
$GMSEC_FEATURE_NOT_SUPPORTED
$GMSEC_INVALID_CONFIG_VALUE
$GMSEC_CONFIG_END_REACHED
$GMSEC_INVALID_MESSAGE
$GMSEC_UNKNOWN_MSG_TYPE
$GMSEC_FIELDS_END_REACHED
$GMSEC_FIELD_TYPE_MISMATCH
$GMSEC_UNKNOWN_FIELD_TYPE
$GMSEC_INVALID_CALLBACK
$GMSEC_REQDISPATCH_FAILURE
$GMSEC_MSGCONVERT_FAILURE
$GMSEC_NO_MESSAGE_AVAILABLE
$GMSEC_TIMEOUT_OCCURRED
$GMSEC_TRACKING_FAILURE
$GMSEC_UNUSED_CONFIG_ITEM
$GMSEC_INVALID_FIELD
$GMSEC_XML_PARSE_ERROR
$GMSEC_INVALID_CONFIG
$GMSEC_INVALID_FIELD_NAME
$GMSEC_OTHER_ERROR );
1;
__END__
=pod
=for html <center><img src=../../gmsec_logo.png width="150" height="150"></center>
=head1 NAME
GMSECAPI - Standard Perl Interface to the GMSEC API
=head1 CAVEAT
B<A threaded version of Perl is required for this API to work.> Please note that thread support is not always built in by default. All binaries retrieved from ActiveState at L<http://www.activestate.com/ActivePerl> are supported. This includes the Linux, Solaris, and Windows versions. It has been tested successfully with Perl versions 5.6.2 and 5.8.3. Below are directions for configuration options needed to build a compatible version of perl. Also note that the Perl GMSEC API built with either of these two versions of perl are not compatible with the other. The GMSEC releases are built with the latest ActiveState release of perl.
1. Download http://www.cpan.org/src/5.0/perl-5.6.2.tar.gz
2. Unzip and untar the downloaded file in a separate directory.
3. Use the following commands to build and install ...
./Configure -de -Dcc=gcc -Dusethreads -Dprefix=~/perl-5.6.2 -Uinstallusrbinperl
make
make test
make install
1. Download http://www.cpan.org/src/5.0/perl-5.8.3.tar.gz
2. Unzip and untar the downloaded file in a separate directory.
3. Use the following commands to build and install ...
./Configure -de -Dcc=gcc -Dusethreads -Duseperlio -Dprefix=~/perl-5.8.3 -Uinstallusrbinperl
make
make test
make install
=head1 SYNOPSIS
use GMSECAPI;
=head1 DESCRIPTION
The C<GMSECAPI> module loads all required packages into the environment and defines all of the constants needed.
=head1 CONSTANTS
=over 8
=item $GMSEC_CONNECTION_ICSSWB
=item $GMSEC_CONNECTION_RENDEZVOUS
=item $GMSEC_CONNECTION_SMARTSOCKETS
Constants are used to define the connection type, or which GMSEC middleware should be used.
=item $GMSEC_TYPE_UNSET
=item $GMSEC_TYPE_CHAR
=item $GMSEC_TYPE_BOOL
=item $GMSEC_TYPE_SHORT
=item $GMSEC_TYPE_USHORT
=item $GMSEC_TYPE_LONG
=item $GMSEC_TYPE_ULONG
=item $GMSEC_TYPE_FLOAT
=item $GMSEC_TYPE_DOUBLE
=item $GMSEC_TYPE_I8
=item $GMSEC_TYPE_U8
=item $GMSEC_TYPE_I16
=item $GMSEC_TYPE_U16
=item $GMSEC_TYPE_I32
=item $GMSEC_TYPE_U32
=item $GMSEC_TYPE_I64
=item $GMSEC_TYPE_F32
=item $GMSEC_TYPE_F64
=item $GMSEC_TYPE_STRING
=item $GMSEC_TYPE_BIN
There are 10 different defined variable types that can be used for message fields.
=item $GMSEC_TRUE
=item $GMSEC_FALSE
True and false values are defined for the GMSEC API.
=item $GMSEC_MSG_UNSET
=item $GMSEC_MSG_PUBLISH
=item $GMSEC_MSG_REQUEST
=item $GMSEC_MSG_REPLY
These are the different message types, including those needed for the publish-subscribe and request-reply paradigms.
=item $GMSEC_NO_WAIT
=item $GMSEC_WAIT_FOREVER
Constants are defined for connections to not wait at all or wait forever for receiving messages on the message bus.
=item $NULL
This is a defined value for NULL.
=item $GMSEC_STATUS_NO_ERROR
=item $GMSEC_STATUS_FACTORY_ERROR
=item $GMSEC_STATUS_CONNECTION_ERROR
=item $GMSEC_STATUS_CONFIG_ERROR
=item $GMSEC_STATUS_MIDDLEWARE_ERROR
=item $GMSEC_STATUS_MESSAGE_ERROR
=item $GMSEC_STATUS_FIELD_ERROR
=item $GMSEC_STATUS_CALLBACK_ERROR
=item $GMSEC_STATUS_CALLBACKLKP_ERROR
Codes are defined for certain classes of errors.
=item $GMSEC_LIBRARY_LOAD_FAILURE
=item $GMSEC_INVALID_CONNECTION_TYPE
=item $GMSEC_AUTODISPATCH_FAILURE
=item $GMSEC_INVALID_CONNECTION
=item $GMSEC_FEATURE_NOT_SUPPORTED
=item $GMSEC_INVALID_CONFIG_VALUE
=item $GMSEC_CONFIG_END_REACHED
=item $GMSEC_INVALID_MESSAGE
=item $GMSEC_UNKNOWN_MSG_TYPE
=item $GMSEC_FIELDS_END_REACHED
=item $GMSEC_FIELD_TYPE_MISMATCH
=item $GMSEC_UNKNOWN_FIELD_TYPE
=item $GMSEC_INVALID_CALLBACK
=item $GMSEC_REQDISPATCH_FAILURE
=item $GMSEC_MSGCONVERT_FAILURE
=item $GMSEC_NO_MESSAGE_AVAILABLE
=item $GMSEC_OTHER_ERROR
Constants are defined for many of the common GMSEC errors.
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="GMSECAPI/Callback.html">Callback</a><br><br>
=for html <a href="GMSECAPI/Config.html">Config</a><br><br>
=for html <a href="GMSECAPI/ConfigFile.html">ConfigFile</a><br><br>
=for html <a href="GMSECAPI/Connection.html">Connection</a><br><br>
=for html <a href="GMSECAPI/ConnectionFactory.html">ConnectionFactory</a><br><br>
=for html <a href="GMSECAPI/Field.html">Field</a><br><br>
=for html <a href="GMSECAPI/Message.html">Message</a><br><br>
=for html <a href="GMSECAPI/Status.html">Status</a><br><br>
=for html <a href="GMSECAPI/Util.html">Util</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# Callback.pm
#
# Description: GMSEC API message callbacks. This module acts as a sample
# template to be used for creating your own callback class. All it does
# is simply print out the message in XML format.
#
##############################################################################
package GMSECAPI::Callback;
use strict;
sub new ($) {
my $this = shift;
my $class = ref($this) || $this;
return bless({ }, $class);
}
sub OnMessage ($$$) {
my ($self, $conn, $msg) = @_;
if ( ref($msg) eq 'GMSECAPI::Message' ) {
print $msg->ToXML, "\n";
}
}
1;
__END__
=head1 NAME
GMSECAPI::Callback - Sample callback package for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
my $cfg = GMSECAPI::Config->new([ @ARGV ]);
my $conn = GMSECAPI::ConnectionFactory::Create($cfg);
$conn->Connect;
my $cb = GMSECAPI::Callback->new;
$conn->Subscribe("gmsec.*.publish", $cb);
$conn->StartAutoDispatch;
=head1 DESCRIPTION
The C<GMSECAPI::Callback> module is a sample callback package that simply prints out the recieved message in an XML format. It is meant to be used as a template for creating your own callback module.
=head1 METHODS
=over 8
=item $cb = GMSECAPI::Callback->new
This method created a new callback object.
=item $cb->OnMessage($conn, $msg)
OnMessage is a method used to handle the processing of messages. $conn is a GMSECAPI::Connection object, and $msg is a GMSECAPI::Message object. This method is called automatically by the message dispatcher.
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Connection.html">Connection</a><br><br>
=for html <a href="Message.html">Message</a><br><br>
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# Config.pm
#
# Description: Class for managing configurations
#
##############################################################################
package GMSECAPI::Config;
use strict;
use base qw(DynaLoader);
use GMSECAPI::Util;
bootstrap GMSECAPI::Config;
sub new ($;$) {
my ($this, $argv) = @_;
my $class = ref($this) || $this;
my $self = { pointer => undef };
bless($self, $class);
if (defined($argv) && ref($argv) eq 'ARRAY') {
Config($self, $argv);
} else {
Config($self);
}
return $self;
}
sub Status {
my ($self) = @_;
return GMSECAPI::Util::GetStatus($self);
}
1;
__END__
=head1 NAME
GMSECAPI::Config - Configuration Class for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
my $cfg = GMSECAPI::Config->new([ @ARGV ]);
$cfg->AddValue('connectionType', $GMSEC_CONNECTION_ICSSWB);
=head1 DESCRIPTION
The C<GMSECAPI::Config> module is a class for managing configurations. Please view the documentation for the C++ version of the GMSEC API to read a functionality overview of all methods listed below. All method names are the same and arguments match up in most cases. The main difference is that the status is stored in the Perl API and is returned in the C++ API.
=head1 METHODS
=over 8
=item $cfg = GMSECAPI::Config->new
=item $cfg = GMSECAPI::Config->new($args);
This method created a new configuration object. The argument in the second constructor is an array reference of name-value configuration pairs.
=item $status = $cfg->Status
The method returns a GMSECAPI::Status object for the status of the last method call in the GMSECAPI::Config class.
=item $cfg->AddValue($name,$value)
=item $cfg->ClearValue($name)
=item $value = $cfg->GetValue($name)
=item $cfg->Clear
=item ($name, $value) = $cfg->GetFirst
=item ($name, $value) = $cfg->GetNext
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="ConfigFile.html">ConfigFile</a><br><br>
=for html <a href="ConnectionFactory.html">ConnectionFactory</a><br><br>
=for html <a href="Message.html">Message</a><br><br>
=for html <a href="Status.html">Status</a><br><br>
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# ConfigFile.pm
#
# Description: Class for managing config files
#
##############################################################################
package GMSECAPI::ConfigFile;
use strict;
use base qw(DynaLoader);
use GMSECAPI::Util;
bootstrap GMSECAPI::ConfigFile;
sub new ($;$) {
my ($this, $filepath) = @_;
my $class = ref($this) || $this;
my $self = { pointer => undef };
bless($self, $class);
ConfigFile($self, $filepath);
return $self;
}
sub Status {
my ($self) = @_;
return GMSECAPI::Util::GetStatus($self);
}
1;
__END__
=head1 NAME
GMSECAPI::ConfigFile - ConfigFile Class for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
my $cfg_file = GMSECAPI::ConfigFile->new($filepath);
=head1 DESCRIPTION
The C<GMSECAPI::ConfigFile> module is a class for managing configuration files. Please view the documentation for the C++ version of the GMSEC API to read a functionality overview of all methods listed below. All method names are the same and arguments match up in most cases. The main difference is that the status is stored in the Perl API and is returned in the C++ API.
=head1 METHODS
=over 8
=item $cfg_file = GMSECAPI::ConfigFile->Load
=item $cfg_file = GMSECAPI::ConfigFile->LookupMessage($msgName, $msg);
=item $cfg_file = GMSECAPI::ConfigFile->LookupConfig($cfgName, $cfg);
=item $cfg_file = GMSECAPI::ConfigFile->LookupConfig($subName, $sub);
=item $status = $cfg_file->Status
The method returns a GMSECAPI::Status object for the status of the last method call in the GMSECAPI::ConfigFile class.
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Config.html">Config</a><br><br>
=for html <a href="Message.html">Message</a><br><br>
=for html <a href="Status.html">Status</a><br><br>
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# Connection.pm
#
# Description: Base class for middleware connections made with the
# ConnectionFactory class
#
##############################################################################
package GMSECAPI::Connection;
use strict;
use base qw(DynaLoader);
use GMSECAPI::Util;
use threads;
use threads::shared;
my $AUTO_DISPATCH_RUNNING :shared;
bootstrap GMSECAPI::Connection;
sub Status
{
my ($self) = @_;
return GMSECAPI::Util::GetStatus($self);
}
sub StartPerlDispatchThread
{
my ($self) = @_;
if (not $AUTO_DISPATCH_RUNNING) {
my $thread = threads->create(sub {
$self->SetThreadedDispatchContext;
{
lock($AUTO_DISPATCH_RUNNING);
$AUTO_DISPATCH_RUNNING = 1;
cond_broadcast($AUTO_DISPATCH_RUNNING);
}
# wait forever
my $untouchable :shared;
{
lock($untouchable);
cond_wait($untouchable);
}
});
$thread->detach;
}
else {
# perl AutoDispatch thread already running...
}
# ensure dispatch thread is running
if (not $AUTO_DISPATCH_RUNNING) {
# if it is not set within 10 seconds, something is seriously wrong
my $start = time();
my $limit = $start + 10;
lock($AUTO_DISPATCH_RUNNING);
while (not $AUTO_DISPATCH_RUNNING) {
last if not cond_timedwait($AUTO_DISPATCH_RUNNING, $limit);
}
if (not $AUTO_DISPATCH_RUNNING) {
die('the perl auto-dispatch thread was not successfully
started');
}
}
}
sub Connect
{
my ($self) = @_;
$self->StartPerlDispatchThread;
$self->SetDispatchContext;
return $self->ConnectXS;
}
sub StartAutoDispatch
{
my ($self) = @_;
$self->ChooseThreadedDispatchContext;
return $self->StartAutoDispatchXS;
}
sub StopAutoDispatch
{
my ($self) = @_;
$self->SetDispatchContext;
# could try to stop the perl thread if noone is using it...
return $self->StopAutoDispatchXS;
}
1;
__END__
=head1 NAME
GMSECAPI::Connection - Connection class for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
my $cfg = GMSECAPI::Config->new([ @ARGV ]);
my $conn = GMSECAPI::ConnectionFactory::Create($cfg);
my $status = $conn->Status;
$conn->Connect;
$conn->Subscribe("gmsec.*.publish");
my $msg = $conn->GetNextMsg($GMSEC_WAIT_FOREVER);
$conn->DestroyMessage($msg);
$conn->Disconnect;
GMSECAPI::ConnectionFactory::Destroy($conn);
my $msg1 = $conn->CreateMessage("gmsec.test1", $GMSEC_MSG_PUBLISH);
my $msg2 = $conn->CreateMessage("gmsec.test2", $GMSEC_MSG_PUBLISH, $cfg);
=head1 DESCRIPTION
The C<GMSECAPI::Connection> class is the interface for all interactions with the GMSEC middleware connection. It is created by the GMSECAPI::ConnectionFactory module. Please view the documentation for the C++ version of the GMSEC API to read a functionality overview of all methods listed below. All method names are the same and arguments match up in most cases. The main difference is that the status is stored in the Perl API and is returned in the C++ API.
=head1 METHODS
=over 8
=item $status = $conn->Status
The method returns a GMSECAPI::Status object for the status of the last method call in the GMSECAPI::Connection class.
=item $conn->Connect
=item $conn->Disconnect
=item $libname = $conn->GetLibraryRootName
=item $version = $conn->GetLibraryVersion
=item $conn->Subscribe($subject)
=item $conn->Subscribe($subject, $callbackObject)
=item $conn->Subscribe($subject, $callbackObject, $objectPackage)
=item $conn->Subscribe($subject, $callbackObject, $objectPackage, $objectMethod)
Above are four ways of subscribing to a particular message subject. The last three versions are used for registering callbacks. The second version uses the GMSECAPI::Callback module as the default callback object package. It simply prints out the received message in an XML format. The third version allows you to specify your own callback package to use. The OnMessage method will be called with by default. The fourth version of Subscribe allows you to specify the name of the method you want called.
=item $conn->UnSubscribe($subject)
=item $msg = $conn->CreateMessage($subject, $msgKind)
=item $msg = $conn->CreateMessage($subject, $msgKind, $cfg)
=item $outMsg = $conn->ConvertMessage($inMsg)
=item $conn->ConvertCleanup($inMsg, $outMsg)
=item $outMsg = $conn->CloneMessage($inMsg)
=item $conn->DestroyMessage($msg)
=item $conn->Publish($msg)
=item $reply = $conn->Request($request, $timeout)
=item $conn->Request($request, $timeout, $callbackObject)
=item $conn->Request($request, $timeout, $callbackObject, $objectPackage)
=item $conn->Request($request, $timeout, $callbackObject, $objectPackage, $objectMethod)
Above are four ways of requesting a message with a particular subject. The last three versions are used for registering callbacks. The second version uses the GMSECAPI::Callback module as the default callback object package. It simply prints out the received message in an XML format. The third version allows you to specify your own callback package to use. The OnMessage method will be called with by default. The fourth version of Request allows you to specify the name of the method you want called.
=item $conn->Reply($request, $reply)
=item $conn->StartAutoDispatch()
=item $conn->StopAutoDispatch()
=item $msg = $conn->GetNextMsg($timeout)
=item $msg = $conn->DispatchMsg($msg)
=item $status = $conn->GetLastDispatcherStatus()
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Callback.html">Callback</a><br><br>
=for html <a href="Config.html">Config</a><br><br>
=for html <a href="ConnectionFactory.html">ConnectionFactory</a><br><br>
=for html <a href="Message.html">Message</a><br><br>
=for html <a href="Status.html">Status</a><br><br>
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# ConnectionFactory.pm
#
# Description: Class for creating and destroying connections
#
##############################################################################
package GMSECAPI::ConnectionFactory;
use strict;
use base qw(DynaLoader);
use GMSECAPI::Util;
bootstrap GMSECAPI::ConnectionFactory;
use vars qw($statusPointer);
sub Status {
if (defined($statusPointer) && $statusPointer =~ /^-?\d+$/) {
return bless({ pointer => $statusPointer }, 'GMSECAPI::Status');
} else {
return undef;
}
}
1;
__END__
=head1 NAME
GMSECAPI::ConnectionFactory - Connection Creation and Destruction for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
my $cfg = GMSECAPI::Config->new([ @ARGV ]);
my $conn = GMSECAPI::ConnectionFactory::Create($cfg);
GMSECAPI::ConnectionFactory::Destroy($conn);
=head1 DESCRIPTION
The C<GMSECAPI> module loads all required packages into the environment and defines all of the constants needed.
=head1 FUNCTIONS
=over 8
=item $conn = GMSECAPI::ConnectionFactory::Create($connType, $cfg)
=item $conn = GMSECAPI::ConnectionFactory::Create($cfg)
This function creates a connection to the GMSEC message bus. The first version has the connection type specified as the first argument. The second version must have the connection type specified in the GMSECAPI::ConnectionFactory object, which is the first argument.
=item GMSECAPI::ConnectionFactory::Destroy($conn)
This function destroys the connection to the GMSEC message bus.
=item $status = GMSECAPI::ConnectionFactory::Status()
This function returns a GMSECAPI::Status object for the status of the last method call in the GMSECAPI::Connection class.
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Config.html">Config</a><br><br>
=for html <a href="Connection.html">Connection</a><br><br>
=for html <a href="Status.html">Status</a><br><br>
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# Field.pm
#
# Description: Base class for message fields
#
##############################################################################
package GMSECAPI::Field;
use strict;
use base qw(DynaLoader);
use GMSECAPI::Util;
bootstrap GMSECAPI::Field;
sub new ($;$$$)
{
my ($this, $type, $name, $value, $size) = @_;
my $class = ref($this) || $this;
my $self = { pointer => undef };
bless($self, $class);
if (defined($type) && $type =~ /^\d+$/)
{
if (defined($size) && $size =~ /^\d+$/ && $type == $GMSECAPI::GMSEC_TYPE_BIN)
{
Field($self, $type, $name, $value, $size);
}
else
{
Field($self, $type, $name, $value);
}
}
else
{
Field($self);
}
return $self;
}
sub Status {
my ($self) = @_;
return GMSECAPI::Util::GetStatus($self);
}
1;
__END__
=head1 NAME
GMSECAPI::Field - Message Field Class for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
my $field = GMSECAPI::Field->new($GMSEC_TYPE_BOOL, 'bool_field', $GMSEC_TRUE);
print $fld->ToXML(), "\n";
=head1 DESCRIPTION
The C<GMSECAPI::Field> module is a class used to manage and manipulate the individual fields of a message. Please view the documentation for the C++ version of the GMSEC API to read a functionality overview of all methods listed below. All method names are the same and arguments match up in most cases. The main difference is that the status is stored in the Perl API and is returned in the C++ API.
=head1 METHODS
=over 8
=item $field = GMSECAPI::Field->new
=item $field = GMSECAPI::Field->new($type, $name, $value)
=item $field = GMSECAPI::Field->new($type, $name, $value, $size)
Above are three constructors for a message field object. The second version sets, the type, name, and value. The third version is for the $GMSEC_TYPE_BIN data type, which requires the value's size as a fourth argument.
=item $status = $field->Status
The method returns a GMSECAPI::Status object for the status of the last method call in the GMSECAPI::Field class.
=item $name = $field->GetName
=item $field->SetName($name)
=item $type = $field->GetType
=item $field->SetType($type)
=item $value = $field->GetValue
=item ($value, $size) = $field->GetValue
=item $field->SetValue($value)
=item $field->SetValue($value, $size)
=item $field->UnSet
=item $xml = $field->ToXML
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Message.html">Message</a><br><br>
=for html <a href="Status.html">Status</a><br><br>
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# Message.pm
#
# Description: Base class for GMSEC messages
#
##############################################################################
package GMSECAPI::Message;
use strict;
use base qw(DynaLoader);
use GMSECAPI::Util;
bootstrap GMSECAPI::Message;
sub Status {
my ($self) = @_;
return GMSECAPI::Util::GetStatus($self);
}
1;
__END__
=head1 NAME
GMSECAPI::Message - Message class for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
my $cfg = GMSECAPI::Config->new([ @ARGV ]);
my $conn = GMSECAPI::ConnectionFactory::Create($cfg);
my $status = $conn->Status;
$conn->Connect;
my $msg = $conn->CreateMessage('gmsec.test.publish', $GMSEC_MSG_PUBLISH);
if ( $msg->isValid ) {
$msg->SetKind($GMSEC_MSG_REQUEST);
$msg->SetSubject('gmsec.test.request');
my $fld = GMSECAPI::Field->new($GMSEC_TYPE_CHAR, 'char_field', 'C');
$msg->AddField($fld);
print $msg->ToXML, "\n";
}
$conn->Disconnect;
GMSECAPI::ConnectionFactory::Destroy($conn);
=head1 DESCRIPTION
The C<GMSECAPI::Message> module is a class for managing and manipulating messages on the GMSEC message bus. Messages are either created directly with the connection object or returned from a request. Please view the documentation for the C++ version of the GMSEC API to read a functionality overview of all methods listed below. All method names are the same and arguments match up in most cases. The main difference is that the status is stored in the Perl API and is returned in the C++ API.
=head1 METHODS
=over 8
=item $status = $msg->Status
This method returns a GMSECAPI::Status object for the status of the last method call in the GMSECAPI::Message class.
=item $valid = $msg->isValid
=item $libname = $msg->GetLibraryRootName
=item $msg->SetKind($kind)
=item $kind = $msg->GetKind
=item $msg->SetSubject($subject)
=item $subject = $msg->GetSubject
=item $msg->AddField($field)
=item $field = $msg->GetField($name)
=item $count = $msg->GetFieldCount
=item $field = $msg->GetFirstField
=item $field = $msg->GetNextField
=item $xml = $msg->ToXML
=item $size = $msg->GetMsgSize
=item $time = $msg->GetTime
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Callback.html">Callback</a><br><br>
=for html <a href="Config.html">Config</a><br><br>
=for html <a href="ConfigFile.html">ConfigFile</a><br><br>
=for html <a href="Connection.html">Connection</a><br><br>
=for html <a href="Field.html">Field</a><br><br>
=for html <a href="Status.html">Status</a><br><br>
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# Status.pm
#
# Description: Class for holding status information
#
##############################################################################
package GMSECAPI::Status;
use strict;
use base qw(DynaLoader);
bootstrap GMSECAPI::Status;
sub new ($;$$$) {
my ($this, $eclass, $code, $text) = @_;
my $class = ref($this) || $this;
my $self = { pointer => undef };
bless($self, $class);
if (defined $eclass && defined $code && defined $text) {
Status($self, $eclass, $code, $text);
} else {
Status($self);
}
return $self;
}
1;
__END__
=head1 NAME
GMSECAPI::Status - Status Class for the Perl GMSEC API
=head1 SYNOPSIS
use GMSECAPI;
$status = GMSECAPI::Status->new($GMSEC_STATUS_CONFIG_ERROR,
$GMSEC_INVALID_CONFIG_VALUE,
'Config value not set');
print $status->Get, "\n";
=head1 DESCRIPTION
The C<GMSECAPI::Status> module is used to store the status of the last executed command for a particular class. Please view the documentation for the C++ version of the GMSEC API to read a functionality overview of all methods listed below. All method names are the same and arguments match up in most cases.
=head1 METHODS
=over 8
=item $status = GMSECAPI::Status->new
=item $status = GMSECAPI::Status->new($class, $code, $text)
The above two methods are constructors for the status class.
=item $string = $status->GetString
=item $string = $status->Get
=item $class = $status->GetClass
=item $code = $status->GetCode
=item $status->SetString($text)
=item $status->SetClass($class)
=item $status->SetCode($code)
=item $status->Set($class, $code, $text)
=item $status->ReSet
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Util.html">Util</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
##############################################################################
# GMSECAPI::Util.pm
#
# Description: Internal utility functions for Perl GMSEC API.
#
##############################################################################
package GMSECAPI::Util;
use strict;
sub GetStatus ($)
{
my ($object) = @_;
if (defined($object->{status}) and $object->{status} =~ /^-?\d+$/) {
return bless({ pointer => $object->{status} }, 'GMSECAPI::Status');
}
else {
return undef;
}
}
1;
__END__
=head1 NAME
GMSECAPI::Util - Utility functions internal to the Perl GMSEC API.
=head1 SYNOPSIS
use GMSECAPI::Util;
my $object = <some GMSECAPI type>;
$object->CallFunction;
return GMSECAPI::Util::GetStatus($object);
=head1 DESCRIPTION
The C<GMSECAPI::Util> module is to provide a central location for functions internal to the Perl GMSEC API.
=head1 METHODS
=over 8
=item $status = GMSECAPI::Util::GetStatus($object);
This method retrieves the GMSECAPI::Status from $object.
=back
=head1 AUTHOR
GMSEC API Team <gmsec-support@lists.nasa.gov>
NASA Goddard Space Flight Center
=head1 SEE ALSO
=for html <a href="Status.html">Status</a><br><br>
=for html <a href="../GMSECAPI.html">GMSECAPI</a><br><br>
=cut
../../bin/lib/GMSECAPI.pm
../../bin/lib/GMSECAPI/Callback.pm
../../bin/lib/GMSECAPI/Config.pm
../../bin/lib/GMSECAPI/ConfigFile.pm
../../bin/lib/GMSECAPI/Connection.pm
../../bin/lib/GMSECAPI/ConnectionFactory.pm
../../bin/lib/GMSECAPI/Field.pm
../../bin/lib/GMSECAPI/Message.pm
../../bin/lib/GMSECAPI/Status.pm
../../bin/lib/GMSECAPI/Util.pm
../../bin/lib/auto/GMSECAPI/Config/Config.so
../../bin/lib/auto/GMSECAPI/ConfigFile/ConfigFile.so
../../bin/lib/auto/GMSECAPI/Connection/Connection.so
../../bin/lib/auto/GMSECAPI/ConnectionFactory/ConnectionFactory.so
../../bin/lib/auto/GMSECAPI/Field/Field.so
../../bin/lib/auto/GMSECAPI/GMSECAPI.so
../../bin/lib/auto/GMSECAPI/Message/Message.so
../../bin/lib/auto/GMSECAPI/Status/Status.so
=head2 Fri Mar 3 08:48:52 2017: C<Module> L<GMSECAPI|GMSECAPI>
=over 4
=item *
C<installed into: ../../bin/lib>
=item *
C<LINKTYPE: dynamic>
=item *
C<VERSION: 1>
=item *
C<EXE_FILES: >
=back
=head2 Fri Mar 3 09:02:16 2017: C<Module> L<GMSECAPI|GMSECAPI>
=over 4
=item *
C<installed into: ../../bin/lib>
=item *
C<LINKTYPE: dynamic>
=item *
C<VERSION: 1>
=item *
C<EXE_FILES: >
=back
rem @echo OFF
rem Copyright 2007-2016 United States Government as represented by the
rem Administrator of The National Aeronautics and Space Administration.
rem No copyright is claimed in the United States under Title 17, U.S. Code.
rem All Rights Reserved.
rem This batch file builds everything for Microsoft Windows
rem Build the main part of the API
set BUILD=gmsecapi gmsec_java gmsec_jni generic_jms bolt mb MBServer dotnet libgmsec_perl gmhelp
IF DEFINED WRAPPERS (
set BUILD=%BUILD% %WRAPPERS%
)
IF DEFINED USER_WRAPPERS (
set BUILD=%BUILD% %USER_WRAPPERS%
)
IF DEFINED GMSEC_x64 (
set MCD=x64
) ELSE (
set MCD=Win32
)
set TMP=
set TEMP=
IF DEFINED GMSEC_VC6 (
call "C:\tools\VC98\Bin\VCVARS32.BAT"
MSBuild.exe gmsecapi_allvendors.sln /t:Rebuild /p:Configuration=Release;Platform=Win32 /p:"VCBuildAdditionalOptions= /useenv"
GOTO Perl
)
IF DEFINED GMSEC_VS2013 (
call "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" x64
)
IF DEFINED GMSEC_VS2010 (
devenv "gmsecapi_allvendors.sln" /upgrade
cd examples/cpp
devenv "cpp.sln" /upgrade
cd ../c
devenv "c.sln" /upgrade
cd ../cs
devenv "cs.sln" /upgrade
cd ../..
)
rem Always start off with a clean slate
MSBuild.exe gmsecapi_allvendors.sln /t:Clean /p:Configuration=Release;Platform=%MCD%
MSBuild.exe gmsecapi_allvendors.sln /t:Clean /p:Configuration=Release-SNK;Platform=%MCD%
rem Build each portion of the solution, in the desired order.
FOR %%i IN (%BUILD%) DO (
IF '%%i'=='dotnet' (
MSBuild.exe gmsecapi_allvendors.sln /t:%%i /p:Configuration=Release-SNK;Platform=%MCD%
) ELSE (
MSBuild.exe gmsecapi_allvendors.sln /t:%%i /p:Configuration=Release;Platform=%MCD%
)
)
:Perl
cd perl\gmsec
rem Build the Perl part of the API
perl -Iextra Makefile.PL PREFIX=../../bin
nmake
nmake install
cd ..\..
rem Build the C++ examples
cd examples/cpp
IF DEFINED GMSEC_VC6 (
call "C:\tools\VC98\Bin\VCVARS32.BAT"
MSBuild.exe cpp.sln /t:Rebuild /p:Configuration=Release /p:"VCBuildAdditionalOptions= /useenv"
) ELSE (
MSBuild.exe cpp.sln /t:Rebuild /p:Configuration=Release;Platform=%MCD%
)
cd ..
rem Build the C examples
cd c
IF DEFINED GMSEC_VC6 (
call "C:\tools\VC98\Bin\VCVARS32.BAT"
MSBuild.exe c.sln /t:Rebuild /p:Configuration=Release /p:"VCBuildAdditionalOptions= /useenv"
) ELSE (
MSBuild.exe c.sln /t:Rebuild /p:Configuration=Release;Platform=%MCD%
)
cd ..
rem Build the C# examples
cd cs
IF DEFINED GMSEC_VS2010 (
MSBuild.exe cs.sln /t:Rebuild /p:TargetFrameworkVersion=v4.0;Configuration=Release;Platform="Any CPU"
) ELSE (
MSBuild.exe cs.sln /t:Rebuild /p:Configuration=Release;Platform="Any CPU"
)
cd ../..
rem Copy validator scripts
mkdir bin\validator
copy validator\env_validator.bat bin\validator
copy validator\get_arch.pl bin\validator
copy validator\perl_ver.pl bin\validator
copy validator\*.env bin\validator
rem Copyright 2007-2016 United States Government as represented by the
rem Administrator of The National Aeronautics and Space Administration.
rem No copyright is claimed in the United States under Title 17, U.S. Code.
rem All Rights Reserved.
rem
rem This batch file builds the open source API for Microsoft Windows
rem
rem Build the main part of the API
IF DEFINED GMSEC_x64 (
MSBuild.exe gmsecapi_opensource.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
) ELSE (
IF DEFINED GMSEC_VC6 (
call "C:\tools\VC98\Bin\VCVARS32.BAT"
MSBuild.exe gmsecapi_opensource.sln /t:Rebuild /p:Configuration=Release /p:"VCBuildAdditionalOptions= /useenv"
) ELSE (
MSBuild.exe gmsecapi_opensource.sln /t:Rebuild /p:Configuration=Release
)
)
cd perl
rem Build the Perl part of the API
perl -Iextra Makefile.PL PREFIX=../bin
nmake
nmake install
cd ..
rem Build the C++ examples
cd examples/cpp
IF DEFINED GMSEC_x64 (
MSBuild.exe cpp.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
) ELSE (
IF DEFINED GMSEC_VC6 (
call "C:\tools\VC98\Bin\VCVARS32.BAT"
MSBuild.exe cpp.sln /t:Rebuild /p:Configuration=Release /p:"VCBuildAdditionalOptions= /useenv"
) ELSE (
MSBuild.exe cpp.sln /t:Rebuild /p:Configuration=Release
)
)
cd ..
rem Build the C examples
cd c
IF DEFINED GMSEC_x64 (
MSBuild.exe c.sln /t:Rebuild /p:Configuration=Release /p:Platform=x64
) ELSE (
IF DEFINED GMSEC_VC6 (
call "C:\tools\VC98\Bin\VCVARS32.BAT"
MSBuild.exe c.sln /t:Rebuild /p:Configuration=Release /p:"VCBuildAdditionalOptions= /useenv"
) ELSE (
MSBuild.exe c.sln /t:Rebuild /p:Configuration=Release
)
)
cd ../..
rem Copy validator scripts
mkdir bin\validator
copy validator\env_validator.bat bin\validator
copy validator\get_arch.pl bin\validator
copy validator\perl_ver.pl bin\validator
copy validator\*.env bin\validator
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
######################################################################
# Build Script
# This script will read the values from files and build an include
# file which will include a unique build number and other debugging
# information.
#
# This program should be called with the following command (probably
# in a make file):
# > buildscript.pl
#
######################################################################
use strict;
eval
{
my $cxx_file = 'framework/include/gmsec_version.h';
my $java_file = 'java/gov/nasa/gsfc/gmsecapi/ApiVersion.java';
my $java_file_4x = 'java/gov/nasa/gsfc/gmsec/api/ApiVersion.java';
my $bolt_file = 'wrapper/bolt/java/bolt/Version.java';
my %info;
getTimestamp(\%info);
# getBuild(\%info);
getGMSEC(\%info);
getOS(\%info);
getCxx(\%info);
getJava(\%info);
getPerl(\%info);
getMagic(\%info);
writeCxx($cxx_file, \%info);
writeJava($java_file, "gmsecapi", \%info);
writeJava($java_file_4x, "gmsec.api", \%info);
writeBolt($bolt_file, "bolt", \%info);
updateDoxygen(\%info, glob('doxygen/*_4x_*.html'));
print "done\n";
};
if ($@) {
print "exception: $@\n";
return 1;
}
exit 0;
# End of Script
##############################################################
#
# Beginning of Subroutines.
#
##############################################################
# Get the build number and increment it in the file
sub slurp
{
my ($path) = @_;
open(FH, $path)
or die("unable to open $path [$!]");
my @lines = <FH>;
chomp(@lines);
close(FH);
return @lines;
}
sub getTimestamp
{
my ($ref) = @_;
my ($sec,$min,$hour,$day,$mon,$year,$wday,$yday,$isdst) = localtime(time);
++$mon;
$year += 1900;
my $datestamp = sprintf('%02d/%02d/%d', $mon, $day, $year);
my $timestamp = sprintf('%02d:%02d:%02d', $hour, $min, $sec);
$ref->{DATESTAMP} = $datestamp;
$ref->{TIMESTAMP} = $timestamp;
}
sub getBuild
{
my ($ref) = @_;
my @in = slurp('lastbuild.inf');
my $build = $in[0];
$build++;
$ref->{BUILD} = $build;
# Write updated info back to file
open(FH,">lastbuild.inf") or die "Unable to clobber lastbuild.inf";
print FH "$build";
close FH;
} # getBuild
sub getGMSEC
{
my ($ref) = @_;
my @in = slurp('version.inf');
my $version = $in[0];
$version =~ s/^\s*(.*?)\s*$/$1/g;
$ref->{API} = $version;
} # getGMSEC
##############################################################
# Get the Perl version number
sub getPerl {
use Config;
my ($ref) = @_;
my $version = sprintf('%vd', $^V);
my $compiler = $Config{ccname} || $Config{cc};
$compiler .= " $Config{ccversion}" if $Config{ccversion};
my $details = "Perl v$version, $compiler, $Config{archname}";
$ref->{PERL} = $details;
} # getPerl
##############################################################
# Get the java version number
sub getJava {
my ($ref) = @_;
my $path = 'java.ver';
open(STDERR, '>' . $path);
system("java -version");
my @in = slurp($path);
my $java = $in[0];
$java =~ s/\"/$1/g;
$java =~ s/^\s*(.*?)\s*$/$1/g;
$ref->{JAVA} = $java;
} # getJava
##############################################################
# Get the C++ version number
sub getCxx
{
my ($ref) = @_;
my $cxx = '';
my $c_env = "$ENV{CXX}";
my $path = 'c.ver';
if ($c_env ne "")
{
open(STDERR, '>' . $path);
system("$c_env -v");
my @in = slurp($path);
foreach my $tmp (@in) {
if ($tmp =~ /version ([\d\.]+)/) {
$cxx = $tmp;
}
}
if (not $cxx) {
$cxx = $in[0];
}
}
else
{ # Means they are using windows.
# try running cl.exe
my $tmpfile = 'msc.tmp';
unlink($tmpfile);
if (system("cl.exe 2> $tmpfile")) {
print "unable to determine cl.exe version- using default\n";
}
elsif (-f $tmpfile) {
my @in = slurp($tmpfile);
foreach (@in) {
if (/Version (\S+)/i) {
$cxx = "Microsoft C/C++ $1";
}
}
}
if (not $cxx) {
# use manually created msc.ver
my @in = slurp('msc.ver');
foreach (@in) {
# Take the string if the word 'version' is in it...
if (/\version/g or m/\CC/g) {
$cxx = $_;
}
} # while(<FH>)
$cxx =~ s/\"/$1/g;
$cxx =~ s/^\s*(.*?)\s*$/$1/g;
}
}
$ref->{CXX} = $cxx;
} # getCxx
##############################################################
# Get the OS version number
sub getOS
{
my ($ref) = @_;
my $path = 'os.ver';
my $c_env = "$ENV{CXX}";
if ($c_env ne "")
{
system("uname -s -r -m > $path");
}
else
{ # Means they are using windows.
system("ver > $path");
}
# Read File in
my @in = slurp($path);
my $os = '';
foreach (@in) {
$os = $_;
}
$os =~ s/\"/$1/g;
$os =~ s/^\s*(.*?)\s*$/$1/g;
$ref->{OS} = $os;
} # getOS
##############################################################
# Get the Message Bus version number
sub getMagic
{
my ($ref) = @_;
my @in = slurp('mb.ver');
my $mb = join(' ', @in);
$mb =~ s/^\s*(.*?)\s*$/$1/g;
$ref->{MAGIC} = $mb;
} # getMagic
sub writeCxx
{
my ($path, $ref) = @_;
open(FH, '>' . $path)
or die("unable to open $path [$!]");
print FH qq(
/*
gmsec_version.h autogenerated on:
$ref->{DATESTAMP} $ref->{TIMESTAMP}
*/
#ifndef gmsec_version_h
#define gmsec_version_h
#define GMSEC_VERSION "GMSEC API v$ref->{API} [$ref->{DATESTAMP}]"
#define GMSEC_VERSION_NUMBER "$ref->{API}"
#define GMSEC_OS "$ref->{OS}"
#define GMSEC_CXX "$ref->{CXX}"
#define GMSEC_JAVA "$ref->{JAVA}"
#define GMSEC_PERL "$ref->{PERL}"
#ifdef GMSEC_OLD_MACROS
#define OS "$ref->{OS}"
#define JAVA_VERSION "$ref->{JAVA}"
#define C_PLUS_PLUS_VERSION "$ref->{CXX}"
#endif /* GMSEC_OLD_MACROS */
#endif
);
close(FH);
} # end of writeCxx
sub writeJava
{
my ($path, $pkgname, $ref) = @_;
open(FH, '>' . $path)
or die("unable to open $path [$!]");
print FH qq(
package gov.nasa.gsfc.$pkgname;
public class ApiVersion {
public final static String GMSEC = "$ref->{API} [$ref->{DATESTAMP}]";
public final static String OS = "$ref->{OS}";
public final static String JAVA = "$ref->{JAVA}";
public final static String CXX = "$ref->{CXX}";
public final static String MB = "$ref->{API} [$ref->{DATESTAMP}]";
public final static String GMSEC_VERSION = "$ref->{API} [$ref->{DATESTAMP}]";
public final static String JAVA_VERSION = "$ref->{JAVA}";
public final static String C_PLUS_PLUS_VERSION = "$ref->{CXX}";
public final static String GMSEC_MB_VERSION = "MB v$ref->{API} [$ref->{DATESTAMP}]";
}
);
close(FH);
} # end of writeJava
sub writeBolt
{
my ($path, $pkgname, $ref) = @_;
open(FH, '>' . $path)
or die("unable to open $path [$!]");
print FH qq(
package $pkgname;
public class Version {
public final static String GMSEC = "$ref->{API} [$ref->{DATESTAMP}]";
public final static String OS = "$ref->{OS}";
public final static String JAVA = "$ref->{JAVA}";
public final static String GMSEC_VERSION = "$ref->{API} [$ref->{DATESTAMP}]";
public final static String JAVA_VERSION = "$ref->{JAVA}";
public final static String GMSEC_BOLT_VERSION = "Bolt v$ref->{API} [$ref->{DATESTAMP}]";
}
);
close(FH);
} # end of writeBolt
sub updateDoxygen
{
my ($ref, @files) = @_;
my $reRelease = qr(Release ([0-9.]+));
foreach my $file (@files) {
my $update = 0;
my @lines = slurp($file);
foreach my $line (@lines) {
if ($line =~ $reRelease) {
if ($1 ne $ref->{API}) {
++$update;
$line =~ s/$reRelease/Release $ref->{API}/g;
print "updateDoxygen: $line\n";
}
}
}
if ($update) {
open(FH, ">$file")
or die("unable to rewrite $file [$!]");
map { print FH "$_\n" } @lines;
close(FH);
}
}
}
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/5/lto-wrapper
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 5.4.0-6ubuntu1~16.04.4' --with-bugurl=file:///usr/share/doc/gcc-5/README.Bugs --enable-languages=c,ada,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-5 --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --with-system-zlib --disable-browser-plugin --enable-java-awt=gtk --enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-5-amd64/jre --enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-5-amd64 --with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-5-amd64 --with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4)
/*
This is a utility for modifying project files for use in
Visual Studio 2010 Express.
Since the Visual Studio 2010 Express project upgrader does not support
64 bit targets, this tool will strip 64 bit references out of the
specified project files.
Usage:
java VS2010e <path> ...
Example:
java VS2010e `find GMSEC_API -name '*.vcproj'`
*/
import java.io.*;
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
class VS2010e
{
private java.io.PrintStream out = System.out;
public static void main (String[] args)
throws Exception {
if (args.length < 1)
System.err.println("usage: java VS2010e <path> ...\n");
else
for (String arg : args)
new VS2010e().process(arg);
}
private void process(String path)
throws Exception {
File infile = new File(path);
File bakfile = temporary(infile, ".old");
File tmpfile = temporary(infile, ".new");
File outfile = new File(path);
InputStream input = new FileInputStream(infile);
StreamSource insource = new StreamSource(input);
DOMResult domresult = new DOMResult();
TransformerFactory factory = TransformerFactory.newInstance();
out.println("DOMResult support is " + factory.getFeature(DOMResult.FEATURE));
Transformer transformer = factory.newTransformer();
transformer.transform(insource, domresult);
input.close();
Document document = (Document) domresult.getNode();
// dump("document", document, true);
remove(document, "Platform", "x64");
remove(document, "Configuration", "\\w+\\|x64");
remove(document, "FileConfiguration", "\\w+\\|x64");
transformer = factory.newTransformer();
Source domsource = new DOMSource(document);
OutputStream output = new FileOutputStream(tmpfile);
StreamResult outresult = new StreamResult(output);
transformer.transform(domsource, outresult);
output.close();
rename(infile, bakfile);
rename(tmpfile, outfile);
}
void dump(String prefix, Node node, boolean recursive) {
out.println(prefix + ":\n\t" + node);
NamedNodeMap attributes = node.getAttributes();
if (attributes != null && attributes.getLength() > 0) {
out.println("\tattributes " + attributes);
for (int i = 0; i < attributes.getLength(); ++i) {
Node a = attributes.item(i);
out.println("\t\t" + a.getNodeName() + " = '" + a.getNodeValue() + "'");
}
}
if (recursive) {
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); ++i)
dump(prefix + "[" + i + "]", children.item(i), true);
}
}
void remove(Document document, String tag, String pattern) {
NodeList nodes = document.getElementsByTagName(tag);
out.println("found " + nodes.getLength() + " " + tag + " elements");
for (int i = nodes.getLength()-1; i >= 0; --i) {
Element element = (Element) nodes.item(i);
String name = element.getAttribute("Name");
if (name.matches(pattern)) {
dump("remove " + tag + "[" + i + "]", element, false);
element.getParentNode().removeChild(element);
}
}
}
File temporary (File infile, String extbase) {
File tmpfile = null;
int i = 0;
while (tmpfile == null) {
++i;
tmpfile = new File(infile.getParent(), infile.getName() + extbase + i);
if (tmpfile.exists())
tmpfile = null;
}
return tmpfile;
}
void rename (File from, File to) {
out.println("renaming " + from + " to " + to);
if (!from.renameTo(to))
out.println("unable to rename " + from + " to " + to);
}
}
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
#
# GMSEC API - Build macros
#
MAKEFILE = Makefile
SUPPORT = $(GMSEC_HOME)/../SUPPORT
BASE_WRAPPERS = mb bolt generic_jms
WRAPPERS = $(BASE_WRAPPERS) $(MW_WRAPPERS) $(USER_WRAPPERS)
SHLIB_EXT = so
JSHLIB_EXT = so
JAVA_BIN = $(JDK_HOME)/bin
# Uncomment the definition below if debugging of the API is required.
#
#DEBUG_FLAGS = -g -O0
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# HP-UX 11.11 PA-RISC gcc build configuration for GMSEC_API
# HP-UX 11.23 PA-RISC gcc build configuration for GMSEC_API
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# platform location of Java headers for JNI
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/hp-ux
CXX = g++
CC = gcc
LINK = $(CXX) -Wl,+s
DLINK = $(CXX) -fPIC -shared -Wl,-b -Wl,+s
SHLIB_EXT = sl
JSHLIB_EXT = sl
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
HP_BUG_FIX = -include gmsec/util/hp_bug.h
# define C/C++ compiler flags
CXXFLAGS = $(DEBUG_FLAGS) -D_GNU_SOURCE -D_REENTRANT $(HP_BUG_FIX) $(INCS)
CFLAGS = $(CXXFLAGS)
# define api/example/test applications LDFLAGS
LDFLAGS = -Wl,+s -L$(BINDIR) -lGMSECAPI -lpthread
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = -fPIC $(CXXFLAGS)
API_LDFLAGS = -lpthread
# perl extension compilation
PERL_CC = $(CXX)
GMSEC_PERL_FLAGS = $(CORE_CXXFLAGS)
# NOTE: below this line still breaks, but above is little improved.
# Still need to correct that flag until it doesn't break.
#GMSEC_PERL_FLAGS = $(BASE_CXXFLAGS)
SSCXXLIB = -lrtsscpp
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Linux x86 build configuration for GMSEC_API
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# platform location of Java headers for JNI
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/linux
JAVA_LIBS = -L$(JDK_HOME)/jre/lib/i386/client -ljvm
CXX = g++
CC = gcc
LINK = $(CXX)
DLINK = $(CXX) -shared
SHLIB_EXT = so
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
# add COVERAGE for code coverage
ifeq ($(COVERAGE),1)
COVERAGE = --coverage
endif
# define C/C++ compiler flags
CXXFLAGS = $(DEBUG_FLAGS) $(COVERAGE) -march=i486 -Wall -D_REENTRANT $(INCS)
CFLAGS = $(CXXFLAGS)
# define api/example/test applications LDFLAGS
LDFLAGS = $(COVERAGE) -L$(BINDIR) -lGMSECAPI -ldl -lpthread
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = -fPIC $(CXXFLAGS)
API_LDFLAGS = $(COVERAGE) -ldl -lpthread
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Linux x86 build configuration for GMSEC_API
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# platform location of Java headers for JNI
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/linux
JAVA_LIBS = -L$(JDK_HOME)/jre/lib/amd64/server -ljvm
CXX = g++
CC = gcc
LINK = $(CXX)
DLINK = $(CXX) -shared
SHLIB_EXT = so
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
# add COVERAGE for code coverage
ifeq ($(COVERAGE),1)
COVERAGE = --coverage
endif
# define C/C++ compiler flags
CXXFLAGS = $(DEBUG_FLAGS) $(COVERAGE) -Wall -D_REENTRANT $(INCS)
CFLAGS = $(CXXFLAGS)
# define api/example/test applications LDFLAGS
LDFLAGS = $(COVERAGE) -L$(BINDIR) -lGMSECAPI -ldl -lpthread
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = -fPIC $(CXXFLAGS)
API_LDFLAGS = $(COVERAGE) -ldl -lpthread
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Mac OS X x86 build configuration for GMSEC API
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# define java directories
#
JAVA_BIN = $(JDK_HOME)/Commands
JAVA_INCS = -I$(JDK_HOME)/Headers
# Uncomment if using Mac OS X 10.8 (Mountain Lion) or later release.
#
OPT_STDCPP = -stdlib=libstdc++
CXX = g++
CC = gcc
LINK = $(CXX) $(OPT_STDCPP) -arch i386
DLINK = $(CXX) $(OPT_STDCPP) -arch i386 -dynamiclib
SHLIB_EXT = dylib
JSHLIB_EXT = jnilib
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
# add COVERAGE for code coverage
ifeq ($(COVERAGE),1)
COVERAGE = --coverage
endif
# define C/C++ compiler flags
CXXFLAGS = $(DEBUG_FLAGS) $(OPT_STDCPP) -arch x86_64 $(COVERAGE) $(INCS)
CFLAGS = $(DEBUG_FLAGS) -arch x86_64 $(COVERAGE) $(INCS)
# define api/example/test applications LDFLAGS
LDFLAGS = $(COVERAGE) -L$(BINDIR) -lGMSECAPI
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = $(CXXFLAGS)
API_LDFLAGS = $(COVERAGE)
# define linker flag for generic jms wrapper
JLINK_FLAGS = $(COVERAGE) -framework JavaVM
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Mac OS X x86-64 build configuration for GMSEC API
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# Define java directories
# Note: Apple and Oracle seem to continuously change the installation
# directory of the JDK, along with the directory layout of such.
# Users are advised to verify if the settings below are appropriate
# for their particular system and installation of JDK.
#
JAVA_BIN = $(JDK_HOME)/bin
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/darwin
# Uncomment if using Mac OS X 10.8 (Mountain Lion) or later release.
#
OPT_STDCPP = -stdlib=libstdc++
CXX = g++
CC = gcc
LINK = $(CXX) $(OPT_STDCPP) -arch x86_64
DLINK = $(CXX) $(OPT_STDCPP) -arch x86_64 -dynamiclib
SHLIB_EXT = dylib
JSHLIB_EXT = jnilib
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
# add COVERAGE for code coverage
ifeq ($(COVERAGE),1)
COVERAGE = --coverage
endif
# define C/C++ compiler flags
CXXFLAGS = $(DEBUG_FLAGS) $(OPT_STDCPP) -arch x86_64 $(COVERAGE) $(INCS)
CFLAGS = $(DEBUG_FLAGS) -arch x86_64 $(COVERAGE) $(INCS)
# define api/example/test applications LDFLAGS
LDFLAGS = $(COVERAGE) -L$(BINDIR) -lGMSECAPI
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = $(CXXFLAGS)
API_LDFLAGS = $(COVERAGE)
# define linker flag for generic jms wrapper
JLINK_FLAGS = $(COVERAGE) -framework JavaVM
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Solaris sparc build configuration for GMSEC_API using Sun CC
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# platform location of Java headers for JNI
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/solaris
# the binary architecture tag
ARCH_DIR = solaris/sparc
CXX = CC
CC = cc
PERL_CC = $(CXX)
LINK = $(CXX)
DLINK = $(CXX) -G
SHLIB_EXT = so
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
# define C/C++ compiler flags
ifneq ($(DEBUG_FLAGS),)
DEBUG_FLAGS = -g
endif
CXXFLAGS = $(DEBUG_FLAGS) $(INCS)
CFLAGS = $(CXXFLAGS)
# define api/example/test applications LDFLAGS
LDFLAGS = -L$(BINDIR) -lGMSECAPI -ldl -lpthread -lm -lsocket -lnsl -lCstd -lCrun
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = -mt -PIC $(CXXFLAGS)
API_LDFLAGS = -ldl -lpthread -lposix4 -lm -lsocket -lnsl -lCstd -lCrun
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Solaris sparc build configuration for GMSEC_API using GCC
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# platform location of Java headers for JNI
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/solaris
# the binary architecture tag
ARCH_DIR = solaris/sparc
CXX = g++
PERL_CC = $(CXX)
LINK = $(CXX)
DLINK = $(CXX) -G
SHLIB_EXT = so
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
# define C/C++ compiler flags
CXXFLAGS = $(DEBUG_FLAGS) -Wall -D_REENTRANT $(INCS)
CFLAGS = $(CXXFLAGS)
# define api/example/test applications LDFLAGS
LDFLAGS = -L$(BINDIR) -lGMSECAPI -ldl -lpthread
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = -fPIC $(CXXFLAGS)
API_LDFLAGS = -ldl -lpthread -lposix4 -lm -lsocket -lnsl
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Solaris sparc build configuration for GMSEC_API using Sun CC but w/ the stlport extension
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# platform location of Java headers for JNI
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/solaris
# the binary architecture tag
ARCH_DIR = solaris/sparc
CXX = CC
CC = cc
PERL_CC = $(CXX)
LINK = $(CXX)
DLINK = $(CXX) -G
SHLIB_EXT = so
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
STL_PORT = -library=stlport4
# define C/C++ compiler flags
ifndef ($(DEBUG_FLAGS),)
DEBUG_FLAGS = -g
endif
CXXFLAGS = $(STL_PORT) $(DEBUG_FLAGS) $(INCS)
CFLAGS = $(DEBUG_FLAGS) $(INCS)
# define api/example/test applications LDFLAGS
LDFLAGS = -L$(BINDIR) -lGMSECAPI -ldl -lpthread -lm -lsocket -lnsl
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = -mt -PIC $(CXXFLAGS)
API_LDFLAGS = $(STL_PORT) -ldl -lpthread -lposix4 -lm -lsocket -lnsl
# Copyright 2007-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Solaris 10 x86 build configuration for GMSEC_API using Sun CC
# load the default macros
include $(GMSEC_HOME)/config/default
BINDIR = $(GMSEC_HOME)/bin
# platform location of Java headers for JNI
JAVA_INCS = -I$(JDK_HOME)/include -I$(JDK_HOME)/include/solaris
JAVA_LIBS = -L$(JDK_HOME)/jre/lib/i386/client -ljvm
# the binary architecture tag
ARCH_DIR = solaris/x86
CXX = CC
CC = cc
PERL_CC = $(CXX)
LINK = $(CXX)
DLINK = $(CXX) -G
SHLIB_EXT = so
INCS = -I$(GMSEC_HOME)/include \
-I$(GMSEC_HOME)/framework/include \
-I$(GMSEC_HOME)/framework/support/include
STL_PORT = -library=stlport4
# define C/C++ compiler flags
CXXFLAGS = $(DEBUG_FLAGS) -mt -D_REENTRANT $(STL_PORT) $(INCS)
CFLAGS = $(CXXFLAGS)
# define api/example/test applications LDFLAGS
LDFLAGS = -L$(BINDIR) -lGMSECAPI $(STL_PORT) -ldl -lpthread -lposix4 -lm -lsocket -lnsl
# define API API_CXXFLAGS and API_LDFLAGS
API_CXXFLAGS = -PIC $(CXXFLAGS)
API_LDFLAGS = $(STL_PORT) -ldl -lpthread -lposix4 -lm -lsocket -lnsl
# Copyright 2009-2016 United States Government as represented by the
# Administrator of The National Aeronautics and Space Administration.
# No copyright is claimed in the United States under Title 17, U.S. Code.
# All Rights Reserved.
# Modify GMSEC API Visual C++ 2008 project files for use with Visual C++ 6.
#
# usage: perl vc6.pl [<file>|<directory>] ...
use strict;
use DirHandle;
use FileHandle;
use constant PROJECT_FILE => 'Project';
use constant SOLUTION_FILE => 'Solution';
{
my %data = (
BACKUP => '.orig',
SIGNAL_FILE => 'vcproj.converted',
COUNT_VCPROJ => 0,
COUNT_SLN => 0,
);
my $task = bless(\%data);
foreach my $arg (@ARGV) {
if (-d $arg) {
if (-e "$arg/$data{SIGNAL_FILE}") {
$task->warning("directory $arg already processed");
next;
}
$task->iterateDirectory($arg, sub {
my ($info) = @_;
my $name = $info->{NAME};
my $full = $info->{FULL};
if ($name =~ /\.vcproj$/) {
$task->processFile(PROJECT_FILE, $full);
}
elsif ($name =~ /\.sln$/) {
$task->processFile(SOLUTION_FILE, $full);
}
});
my $fh = FileHandle->new("$arg/$data{SIGNAL_FILE}", 'w');
$fh->print("$task->{COUNT_VCPROJ} .vcproj files converted\n");
$fh->print("$task->{COUNT_SLN} .sln files converted\n");
$fh->close;
}
elsif (-f $arg) {
if ($arg =~ /\.sln$/) {
$task->processFile(SOLUTION_FILE, $arg);
}
else {
$task->processFile(PROJECT_FILE, $arg);
}
}
else {
$task->warning("ignoring $arg [not a file or directory");
}
}
}
sub dirContents
{
my ($dir) = @_;
my $dh = DirHandle->new($dir);
if (not $dh) {
die("unable to open $dir [$!]");
}
my @names = $dh->read;
undef($dh);
my $sep = '/';
my @contents;
foreach my $name (@names) {
next if $name eq '.';
next if $name eq '..';
my $path = "$dir$sep$name";
my %info = (
DIR => $dir,
NAME => $name,
FULL => $path,
);
push(@contents, \%info);
}
return @contents;
}
sub iterateDirectory
{
my ($self, $dir, $filesub, $dirsub) = @_;
my @contents = dirContents($dir);
foreach my $info (@contents) {
if (-d $info->{FULL}) {
if ($dirsub) {
$dirsub->($info);
}
else {
# recurse by default
$self->iterateDirectory($info->{FULL}, $filesub, $dirsub);
}
}
elsif (-f $info->{FULL}) {
$filesub->($info);
}
}
}
sub processFile
{
my ($self, $type, $full) = @_;
print "process $type file $full\n";
my $old = "$full$self->{BACKUP}";
if (-e $old) {
$self->warning("$old already exists");
}
rename($full, $old)
or die("unable to rename($full, $old) [$!]");
my $in = FileHandle->new($old)
or die("unable to open $old [$!]");
my $out = FileHandle->new($full, 'w')
or die("unable to create $full [$!]");
my $method = 'process' . $type . 'File';
$self->$method($in, $out);
$out->close;
undef($in);
}
sub processProjectFile
{
my ($self, $in, $out) = @_;
++$self->{COUNT_PROJECT};
my $inTool = undef;
my $tool = undef;
while (<$in>) {
my $line = $_;
if (not $inTool) {
if (/<Tool/) {
$inTool = 1;
}
elsif (m|/>|) {
$inTool = 0;
}
}
elsif (not $tool) {
if (/Name="(.+)"/) {
$tool = $1;
# print "started tool '$tool'\n";
}
}
else {
if (/RandomizedBaseAddress=/) {
$line =~ s/Randomized.+/RandomizedBaseAddress="0"/;
}
elsif (/BasicRuntimeChecks=/) {
$line =~ s/BasicRuntime.+/BasicRuntimeChecks="0"/;
}
elsif (/LinkIncremental=/) {
$line =~ s/LinkIncremental.+/LinkIncremental="0"/;
}
elsif (/Detect64BitPortabilityProblems/) {
$line =~ s/Detect64BitPort.+/Detect64BitPortabilityProblems="false"/;
}
elsif ($tool eq 'VCCLCompilerTool' and /PreprocessorDefinitions="(.+)"/) {
# add GMSEC_VC6
$line =~ s/="/="GMSEC_VC6;/;
}
elsif ($tool eq 'VCPostBuildEventTool' and /CommandLine/) {
# change to copy VC6 redistributables
}
elsif (m|/>|) {
# finish Tool
# print "\tfinishing '$tool'\n";
# set ErrorReporting for compiler
if ($tool eq 'VCCLCompilerTool') {
$self->put($out, qq(UseUnicodeResponseFiles="false"));
$self->put($out, qq(AdditionalOptions="/GR"));
$self->put($out, qq(ErrorReporting="0"));
}
# disable manifest
if ($tool eq 'VCLinkerTool') {
$self->put($out, qq(UseUnicodeResponseFiles="false"));
$self->put($out, qq(GenerateManifest="false"));
$self->put($out, qq(ErrorReporting="0"));
}
$tool = undef;
$inTool = 0;
}
}
if (defined($line)) {
$out->print($line);
}
$line =~ /^(\s*)/;
$self->{PREFIX} = $1;
}
}
sub processSolutionFile
{
my ($self, $in, $out) = @_;
++$self->{COUNT_SOLUTION};
my $inGlobal = undef;
my $tool = undef;
my $reDiscard = qr(gmsec_activemq2|gmsec_activemq3|logging_c);
my $reID = qr(\{[-A-Z0-9]+\});
my %discard;
while (<$in>) {
my $line = $_;
if (not $inGlobal) {
if ($line =~ /^Global/) {
$inGlobal = 1;
}
elsif ($line =~ /Project\("$reID"\)
\s*=\s*"$reDiscard",\s*
"[^"]+",\s*
"($reID)"/x) {
my $id = $1;
print "found discard project '$id'\n";
$discard{$id} = 1;
}
}
elsif ($line =~ /^\s+($reID)\.
(Release|Debug)\|(Win32|x64)\.(ActiveCfg|Build.0)
\s*=\s*(Release|Debug)\|(Win32|x64)
/x) {
my $id = $1;
if ($discard{$id}) {
print "ignoring $line";
undef($line);
}
}
if (defined($line)) {
$out->print($line);
}
$line =~ /^(\s*)/;
$self->{PREFIX} = $1;
}
}
sub warning
{
shift;
print "warning: @_\n";
}
sub put
{
my ($self, $out, $text) = @_;
$out->print("$self->{PREFIX}$text\n");
}
Binary files a/gmsec_sys_data/GMSEC_API-4.2/dotnet/app.rc and /dev/null differ
This diff is collapsed.
/*
* Copyright 2007-2016 United States Government as represented by the
* Administrator of The National Aeronautics and Space Administration.
* No copyright is claimed in the United States under Title 17, U.S. Code.
* All Rights Reserved.
*/
/*
* Classification
*
* UNCLASSIFIED
*
*/
#ifndef Callback_Net
#define Callback_Net
// managed
#include "Connection_Net.h"
#include "Message_Net.h"
#include "GMSEC_Net.h"
// native
#include "gmsec/Callback.h"
namespace Nasa
{
namespace Gmsec
{
namespace Net
{
// Forward references
ref class Config;
ref class Status;
/// <summary>
/// This class is the abstract base class for received message callbacks.
/// A user created class, derrived from this class, can be passed into
/// Subscribe() and Request() to have user code executed asynchronously
/// when a message is received.
/// </summary>
/// <example>
/// <code lang="C++">
/// Example Callback Class: C++ CLI:
/// public ref class PublishCallback : public Callback
/// {
/// public:
/// virtual void OnMessage(Connection^ conn, Message^ msg) override
/// {
/// String^ tmp;
/// msg->ToXML(tmp);
/// Console::WriteLine(tmp);
/// }
/// };
/// //Example Callback registration: C++ CLI:
/// PublishCallback^ cb = gcnew PublishCallback();
/// Status^ result = conn->Subscribe("gmsec.*.publish", cb);
/// if( result->IsError() ) { /* handle error */ }
/// </code>
/// <code lang="C#">
/// Example Callback Class: C#:
/// public class PublishCallback : Callback
/// {
/// public override void OnMessage(Connection conn, Message msg)
/// {
/// String tmp;
/// msg.ToXML(out tmp);
/// Console.WriteLine(tmp);
/// }
/// };
/// //Example Callback registration: C#:
/// PublishCallback cb = new PublishCallback();
/// Status result = conn.Subscribe("gmsec.*.publish", cb);
/// if (result.IsError()) { /* handle error */ }
/// </code>
/// <code lang="VB.NET">
/// 'Example Callback Class: VB:
/// Public Class PublishCallback
/// Inherits Callback
/// Public Overrides Sub OnMessage(conn As Connection, msg As Message)
/// Dim tmp As String
/// tmp = Nothing
/// msg.ToXML(tmp)
/// Console.WriteLine(tmp)
/// End Sub
/// End Class
/// 'Example Callback registration: VB:
/// Dim cb As New PublishCallback()
/// Dim result As Status
/// result = conn.Subscribe("gmsec.*.publish", cb)
/// If (result.IsError()) Then
/// ' handle error
/// </code>
/// <code lang="f#">
/// //Example Callback registration: F#:
/// type PublishCallback() =
/// inherit Callback()
/// override this.OnMessage(conn, msg) =
/// let (res, tmp) = msg.ToXML();
/// Console.WriteLine(tmp);
/// let cb = new PublishCallback();
/// let result = conn.Subscribe("gmsec.*.publish", cb);
/// if( result.IsError() ) then () // Handle Error
/// </code>
/// </example>
/// <seealso cref="Connection::Subscribe(const String ^ subject, Nasa::Gmsec::Net::Callback ^ cb)" />
public ref class Callback abstract
{
private:
gmsec::Callback * mImpl;
internal:
/// <summary>Get unmanaged implementation version</summary>
/// <returns>Unmanaged implementation</returns>
gmsec::Callback * GetUnmanImpl();
/// <summary>Reset unmanaged implementation to null</summary>
void ResetUnmanImpl();
/// <summary>Delete old impl if present, and set unmanaged implementation to new value</summary>
void SetUnmanImpl(gmsec::Callback* callback);
protected:
/// <summary>Finalizer, free memory and set objects to null</summary>
!Callback();
/// <summary>
/// Pass through to callback managed class
/// </summary>
/// <param name="conn">connection on which the message was recieved</param>
/// <param name="msg">the recieved message</param>
void OnMessageNative(gmsec::Connection *conn, gmsec::Message *msg);
public:
/// <summary>Default Constructor</summary>
Callback();
/// <summary>Destructor</summary>
virtual ~Callback();
/// <summary>This function is called by the API in response to a message, from either the DispatchMsg()
/// call or inside the Auto-dispatcher after a StartAutoDispatch() call. A class derrived from
/// Callback needs to be registered with a connection, using Subscribe() in order
/// to be called for a particular subject registration pattern.
/// The prototype for this funtion is in the code section:</summary>
/// <remarks>
/// <b>DO NOT DESTROY</b> the Connection, or Message that is passed into this function by the API.
/// They are owned by the API and do not need to be managed by the client program. Also, they can
/// not be stored by the client program beyond the scope of this callback function. In order to store
/// the <see cref="Message"/>, it must be cloned with Connection::CloneMessage()"/>.
/// </remarks>
/// <param name="conn">connection on which the message was recieved</param>
/// <param name="msg">the recieved message</param>
virtual void OnMessage(Nasa::Gmsec::Net::Connection ^ conn, Nasa::Gmsec::Net::Message ^ msg);
};
}
}
}
#endif // Callback_Net
/*
* Copyright 2007-2016 United States Government as represented by the
* Administrator of The National Aeronautics and Space Administration.
* No copyright is claimed in the United States under Title 17, U.S. Code.
* All Rights Reserved.
*/
/*
* Classification
*
* UNCLASSIFIED
*
*/
#ifndef Config_Net
#define Config_Net
// managed
#include "status_Net.h"
#include "GMSEC_Net.h"
#include "GMSECErrors_Net.h"
// native
#include "gmsec/Config.h"
namespace Nasa
{
namespace Gmsec
{
namespace Net
{
// Forward references
ref class Connection;
ref class Message;
/// <summary>
/// This class is a collection for managing connection configuration items.
/// Encapsulates the parameters necessary for initialization Connections and setting middleware dependent
/// values in Messages. Used by the ConnectionFactory and Message, this class provides a generic means
/// of supplying initialization data without being Connection/Message specific.
/// </summary>
/// <example>
/// <code lang="C++">
/// Config^ cfg = gcnew Config(args); // create from main parameters
/// String^ name = nullptr;
/// String^ value = nullptr;
/// Status^ res = cfg->GetFirst(name, value); // get first value
/// while(!res->IsError()) {
/// Console::WriteLine(name + "," + value);
/// res = cfg->GetNext(name, value); // get next value
/// }
/// </code>
/// <code lang="C#">
/// Config cfg = new Config(args); // create from main parameters
/// String name = null;
/// String value = null;
/// Status res = cfg.GetFirst(out name, out value); // get first value
/// while(!res.IsError()) {
/// Console.WriteLine(name + "," + value);
/// res = cfg.GetNext(out name, out value); // get next value
/// }
/// </code>
/// <code lang="VB.NET">
/// Dim cfg As New Config(args)
/// Dim name As String
/// Dim value As String
/// name = Nothing
/// value = Nothing
/// Dim result As Status
/// result = cfg.GetFirst(name, value) ' get first value
/// While (Not result.IsError())
/// Console.WriteLine(name + "," + value)
/// result = cfg.GetNext(name, value) ' get next value
/// End While
/// </code>
/// <code lang="f#">
/// let cfg = new Config(args)// create from main parameters
/// let (res, name, value) = cfg.GetFirst(); // get first value
/// let mutable IsError = res.IsError()
/// let mutable nameTop = name
/// let mutable valueTop = value
/// while not IsError do
/// Console.WriteLine(nameTop + "," + valueTop)
/// let (res2, name2, value2) = cfg.GetNext() // get next value
/// IsError &lt;- res2.IsError()
/// nameTop &lt;- name2
/// valueTop &lt;- value2
/// </code>
/// </example>
/// <seealso cref="Connection" />
/// <seealso cref="Message" />
public ref class Config
{
private:
gmsec::Config * mImpl;
/// <summary>Generates a default config, with no parameters</summary>
inline void GenerateDefaultConfig();
internal:
/// <summary>This constructor creates the association of this object with an existing unmanaged object</summary>
/// <param name="config">unmanaged implementation to initialize with</param>
Config(gmsec::Config* config);
/// <summary>Get unmanaged implementation version</summary>
/// <returns>Unmanaged implementation</returns>
gmsec::Config * GetUnmanImpl();
/// <summary>Reset unmanaged implementation to null</summary>
void ResetUnmanImpl();
/// <summary>Delete old impl if present, and set unmanaged implementation to new value</summary>
void SetUnmanImpl(gmsec::Config* config);
protected:
/// <summary>Finalizer, free memory and set objects to null</summary>
!Config();
public:
/// <summary>Default Constructor</summary>
Config();
/// <summary>Constructor</summary>
/// <param name="argv">argv</param>
Config(array<String ^> ^ argv);
/// <summary>This constructor will create a config and parse values from the passed in xml string.
/// The xml format is the same as used by the FromXML() and ToXML() functions.</summary>
/// <seealso cref="FromXML()" />
/// <seealso cref="ToXML()" />
/// <param name="xml">string in xml format (see FromXML)</param>
Config(const String ^ xml);
/// <summary>Basic (and safe) deep copy constructor</summary>
/// <param name="config">config object to copy</param>
Config(const Nasa::Gmsec::Net::Config ^ config);
/// <summary>brief destructor</summary>
~Config();
/// <summary>This function adds a value to the config object by name</summary>
/// <param name="name">name of value to add</param>
/// <param name="value">value to be added</param>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ AddValue(const String ^ name, const String ^ value);
/// <summary>This function clears a value by name</summary>
/// <param name="name">name of value to clear</param>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ ClearValue(const String ^ name);
/// <summary>This function gets a value by name. The scope of the value
/// is the life of the Config object, or until the next %GetValue() call.</summary>
/// <param name="name">name of value to get</param>
/// <param name="value">output parameter value</param>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ GetValue(const String ^ name,
[Runtime::InteropServices::Out] const String ^ %value);
/// <summary>This function attempts to get a named value as a boolean. (true/false)
/// It will return the default value if the field is not set, or the value does
/// not conform to "true" or "false".</summary>
/// <param name="name">name of value to get</param>
/// <param name="defaultValue">default value describe above</param>
/// <returns>value of named item</returns>
bool CheckBoolValue(const String ^ name, bool defaultValue);
/// <summary>This function clears all values</summary>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ Clear();
/// <summary>This function gets the first name and value for iteration. The scope
/// of the name and value are the life of the Config object, or
/// until the next GetFirst() call.</summary>
/// <param name="name">output parameter name of value</param>
/// <param name="value">output parameter value</param>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ GetFirst(
[Runtime::InteropServices::Out] const String ^ %name,
[Runtime::InteropServices::Out] const String ^ %value);
/// <summary>This function gets the next name and value for iteration. The scope
/// of the name and value are the life of the Config object, or
/// until the next GetNext() call.</summary>
/// <param name="name">output parameter name of value</param>
/// <param name="value">output parameter value</param>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ GetNext(
[Runtime::InteropServices::Out] const String ^ %name,
[Runtime::InteropServices::Out] const String ^ %value);
/// <summary>This function will dump this config to XML.The format is the same as that which is parsed by FromXML().</summary>
/// <seealso cref="FromXML()" />
/// <param name="xml">output parameter: xml string</param>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ ToXML(
[Runtime::InteropServices::Out] const String ^ %xml);
/// <summary>This function will read a config from XML
/// The format is the same as that which is generated by ToXML().</summary>
/// <example>
/// <code lang="xml" xml:space="preserve">
/// <CONFIG>
/// <PARAMETER NAME="connectiontype">gmsec_ss</PARAMETER>
/// <PARAMETER NAME="server">tcp:10.1.2.159</PARAMETER>
/// <PARAMETER NAME="tracking">true</PARAMETER>
/// <PARAMETER NAME="isthreaded">true</PARAMETER>
/// </CONFIG>
/// </code>
/// </example>
/// <seealso cref="ToXML()" />
/// <param name="xml">xml string</param>
/// <returns>status object with the result of the operation</returns>
Nasa::Gmsec::Net::Status ^ FromXML(const String ^ xml);
};
}
}
}
#endif // Config_Net
/*
* Copyright 2007-2016 United States Government as represented by the
* Administrator of The National Aeronautics and Space Administration.
* No copyright is claimed in the United States under Title 17, U.S. Code.
* All Rights Reserved.
*/
/*
* Classification
*
* UNCLASSIFIED
*
*/
#ifndef ConnectionFactory_Net
#define ConnectionFactory_Net
// managed
#include "Config_Net.h"
#include "Connection_Net.h"
#include "Status_Net.h"
#include "GMSEC_Net.h"
#include "GMSECDefs_Net.h"
#include "GMSECErrors_Net.h"
// native
#include "gmsec/ConnectionFactory.h"
namespace Nasa
{
namespace Gmsec
{
namespace Net
{
/// <summary>
/// This class contains static methods for the creation/destruction of connection objects
/// This class is NOT an abstract base class, it will have complete implementation that
/// would call the appropriate Connection object constructor for the requested connection.
/// The create function returns a Connection object associated with the determined connection
/// type but does not actually establish the connection. The Connection object method <see cref="Connection::Connect()"/>
/// is required to establish the software bus connection.
/// </summary>
public ref class ConnectionFactory
{
public:
/// <summary>This function returns a string containing the description of the current API version</summary>
/// <returns>the current GMSEC API version string</returns>
static const String ^ GetAPIVersion();
/// <summary>This function is used to create a connection, although the connection type
/// is inside the Config as an item named "connectionType" and
/// whose value is the root library name for a middleware.
/// For example, the icsswb can be designated by the following (code section):</summary>
/// <example>
/// <code lang="C++">
// create config
/// Config^ cfg = gcnew Config();
/// // add connectionType to config
/// Status^ result = cfg->AddValue("connectionType","gmsec_icsswb");
/// if( result->IsError() ) { /* handle error */ }
/// Connection^ conn;
/// // create connection
/// result = ConnectionFactory::Create(cfg, conn);
/// if( result->IsError() ) { /* handle error */ }
/// // do something
/// // destroy connection
/// result = ConnectionFactory::Destroy(conn);
/// if( result->IsError() ) { /* handle error */ }
/// </code>
/// <code lang="C#">
/// // create config
/// Config cfg = new Config();
/// // add connectionType to config
/// Status result = cfg.AddValue("connectionType","gmsec_icsswb");
/// if (result.IsError()) { /* handle error */ }
/// Connection conn;
/// // create connection
/// result = ConnectionFactory.Create(cfg, out conn);
/// if (result.IsError()) { /* handle error */ }
/// // do something
/// // destroy connection
/// result = ConnectionFactory.Destroy(conn);
/// if (result.IsError()) { /* handle error */ }
/// </code>
/// <code lang="VB.NET">
/// ' create config
/// Dim cfg As New Config()
/// ' add connectionType to config
/// Dim result As Status
/// result = cfg.AddValue("connectionType", "gmsec_icsswb")
/// If (result.IsError()) Then
/// 'handle error
/// End If
/// Dim conn As Connection
/// conn = Nothing
/// ' create connection
/// result = ConnectionFactory.Create(cfg, conn)
/// If (result.IsError()) Then
/// 'handle error
/// End If
/// ' do something
/// ' destroy connection
/// result = ConnectionFactory.Destroy(conn)
/// If (result.IsError()) Then
/// 'handle error
/// End If
/// </code>
/// <code lang="f#">
/// // create config
/// let cfg = new Config();
/// // add connectionType to config
/// let result = cfg.AddValue("connectionType","gmsec_icsswb");
/// if( result.IsError() ) then () // Handle Error
/// // create connection
/// let (result2, conn) = ConnectionFactory.Create(cfg);
/// if( result2.IsError() ) then () // Handle Error
/// // do something
/// // destroy connection
/// let result3 = ConnectionFactory.Destroy(conn);
/// if( result3.IsError() ) then () // Handle Error
/// </code>
/// </example>
/// <param name="config">config object specifying connection parameters</param>
/// <param name="conn">out parameter, created connection</param>
/// <returns>result of the operation</returns>
static Nasa::Gmsec::Net::Status ^ Create(Nasa::Gmsec::Net::Config ^ config,
[Runtime::InteropServices::Out] Nasa::Gmsec::Net::Connection ^ %conn);
/// <summary>This function is used to destroy a connection</summary>
/// <param name="conn">connection to destroy</param>
/// <returns>status - result of the operation</returns>
static Nasa::Gmsec::Net::Status ^ Destroy(Nasa::Gmsec::Net::Connection ^ conn);
};
}
}
}
#endif // ConnectionFactory_Net
/*
* Copyright 2007-2016 United States Government as represented by the
* Administrator of The National Aeronautics and Space Administration.
* No copyright is claimed in the United States under Title 17, U.S. Code.
* All Rights Reserved.
*/
/*
* Classification
*
* UNCLASSIFIED
*
*/
#ifndef ErrorCallback_Net
#define ErrorCallback_Net
// managed
#include "Message_Net.h"
#include "GMSEC_Net.h"
// native
#include "gmsec/ErrorCallback.h"
using namespace System;
using namespace gmsec;
namespace Nasa
{
namespace Gmsec
{
namespace Net
{
// Forward references
ref class Config;
ref class Connection;
ref class Status;
/// <summary>
/// This class is the abstract base class for error callbacks.
/// A user created class, derrived from this class, can be passed into
/// RegisterErrorCallback() to have user code executed asynchronously
/// when an error occurs in the connection object.
/// </summary>
/// <example>
/// <code lang="C++">
/// //Example callback class: C++ CLI
/// public ref class DumpErrorCallback : public ErrorCallback
/// {
/// public:
/// virtual void OnError(Connection^ conn, Message^ msg, Status^ status, String^ event) override
/// {
/// Console::WriteLine(status->Get());
/// }
/// };
/// //Example callback registration:
/// DumpErrorCallback^ cb = gcnew DumpErrorCallback();
/// Status^ result = conn->RegisterErrorCallback("CONNECTION_REQUEST_TIMEOUT", cb);
/// if( result->IsError() ) { /* handle error */ }
/// </code>
/// <code lang="C#">
/// //Example callback class: C#
/// public class DumpErrorCallback : ErrorCallback
/// {
/// public override void OnError(Connection conn, Message msg, Status status, String eventStr)
/// {
/// Console.WriteLine(status.Get());
/// }
/// };
/// //Example callback registration:
/// DumpErrorCallback cb = new DumpErrorCallback();
/// Status result = conn.RegisterErrorCallback("CONNECTION_REQUEST_TIMEOUT", cb);
/// if (result.IsError()) { /* handle error */ }
/// </code>
/// <code lang="VB.NET">
/// 'Example callback class: VB
/// Public Class DumpErrorCallback
/// Inherits ErrorCallback
/// Public Overrides Sub OnError(conn As Connection, msg As Message, status As Status, eventStr As String)
/// Console.WriteLine(status.Get())
/// End Sub
/// End Class
/// 'Example callback registration:
/// Dim cb As New DumpErrorCallback()
/// Dim result As Status
/// result = conn.RegisterErrorCallback("CONNECTION_REQUEST_TIMEOUT", cb)
/// If (result.IsError()) Then
/// 'handle error
/// End If
/// </code>
/// <code lang="f#">
/// type DumpErrorCallback() =
/// inherit ErrorCallback()
/// override this.OnError(conn, msg, status, eventStr) =
/// Console.WriteLine(status.Get());
/// let cb = new DumpErrorCallback();
/// let result = conn.RegisterErrorCallback("CONNECTION_REQUEST_TIMEOUT", cb);
/// if( result.IsError() ) then () // Handle Error
/// </code>
/// </example>
public ref class ErrorCallback abstract
{
private:
gmsec::ErrorCallback * mImpl;
protected:
/// <summary>Finalizer, free memory and set objects to null</summary>
!ErrorCallback();
/// <summary>
/// Pass through to callback managed class
/// </summary>
/// <param name="conn">connection</param>
/// <param name="msg">msg that gets error</param>
/// <param name="status">status showing error</param>
/// <param name="event">string of event</param>
void OnErrorNative(gmsec::Connection *conn, gmsec::Message *msg, gmsec::Status *status, const char* event);
internal:
/// <summary>Get unmanaged implementation version</summary>
/// <returns>Unmanaged implementation</returns>
gmsec::ErrorCallback * GetUnmanImpl();
/// <summary>Reset unmanaged implementation to null</summary>
void ResetUnmanImpl();
/// <summary>Delete old impl if present, and set unmanaged implementation to new value</summary>
void SetUnmanImpl(gmsec::ErrorCallback* errorCallback);
public:
/// <summary>Constructor</summary>
ErrorCallback();
/// <summary>Destructor</summary>
virtual ~ErrorCallback();
/// <summary>This function is called in response to a error after a call to RegisterErrorCallback().</summary>
/// <remarks>
/// <b>DO NOT DESTROY</b> the Connection, Message, or Status that is passed into this function by the API.
/// They are owned by the API and do not need to be managed by the client program. Also, they can
/// not be stored by the client program beyond the scope of this callback function. In order to store
/// the gmsec::Message, it must be cloned with Connection::CloneMessage().
/// Message is not returned in all uses of the callback, if it is not used, msg will be set to NULL.
/// </remarks>
/// <example>
/// <code>
/// virtual void CALL_TYPE OnError(Connection *conn, Message *msg, Status *status, const char* event)
/// </code>
/// </example>
/// <param name="conn">connection</param>
/// <param name="msg">msg that gets error</param>
/// <param name="status">status showing error</param>
/// <param name="event_str">string of event</param>
virtual void OnError(Nasa::Gmsec::Net::Connection ^ conn,
Nasa::Gmsec::Net::Message ^ msg, Nasa::Gmsec::Net::Status ^ status,
String ^ event_str);
};
}
}
}
#endif // ErrorCallback_Net
/*
* Copyright 2007-2016 United States Government as represented by the
* Administrator of The National Aeronautics and Space Administration.
* No copyright is claimed in the United States under Title 17, U.S. Code.
* All Rights Reserved.
*/
/*
* Classification
*
* UNCLASSIFIED
*
*/
#ifndef FieldIterator_h
#define FieldIterator_h
// managed
#include "Field_Net.h"
#include "GMSEC_Net.h"
// native
#include "gmsec/FieldIterator.h"
namespace Nasa
{
namespace Gmsec
{
namespace Net
{
/// <summary>
/// Choose what type of fields to iterate over
/// </summary>
public enum class FieldSelectorChoice
{
/// <summary>
/// All Fields
/// </summary>
SelectAllFields,
/// <summary>
/// All Header Fields
/// </summary>
SelectHeaderFields,
/// <summary>
/// All Non Header Fields
/// </summary>
SelectNonheaderFields
};
/// <summary>
/// The FieldIterator supports iterating over the Fields of a Message.
/// FieldIterators are non-intrusive. Since they are non-intrusive there can
/// be more than one iterating over a single Message at the same time.
/// This differs from Message GetFirstElement/GetNextElement. It is allowed
/// to use both GetFirstElement/GetNextElement and FieldIterator(s) on a
/// Message.
/// After constructing a FieldIterator, iteration is initiated by invoking
/// Message::Reset(FieldIterator^ iterator). For example,
/// </summary>
/// <remarks>
/// Note that modifying the Fields of a Message (e.g., by calling AddField,
/// ClearFields, or ClearFields) while iterating over it is not supported.
/// Further note that FieldIterators are not thread safe.
/// </remarks>
/// <example>
/// <code lang="C++">
/// Status^ applyToHeaderFields (Message^ message)
/// {
/// FieldIterator^ i = gcnew FieldIterator(FieldSelectorChoice::selectHeaderFields);
/// Field^ field = gcnew Field();
/// Status^ result = message->Reset(i);
/// while (!result->IsError() &amp;&amp; i->HasNext())
/// {
/// result = i->Next(field);
/// if (!result->IsError())
/// {
/// // do something on field
/// }
/// }
/// return result;
/// }
/// </code>
/// <code lang="C#">
/// Status applyToHeaderFields (Message message)
/// {
/// FieldIterator i = new FieldIterator(FieldSelectorChoice.selectHeaderFields);
/// Field field = new Field();
/// Status result = message.Reset(i);
/// while (!result.IsError() &amp;&amp; i.HasNext())
/// {
/// result = i.Next(field);
/// if (!result.IsError())
/// {
/// // do something on field
/// }
/// }
/// return result;
/// }
/// </code>
/// <code lang="VB.NET">
/// Function applyToHeaderFields(message As Message) As Status
/// Dim i As New FieldIterator(FieldSelectorChoice.selectHeaderFields)
/// Dim field As New Field()
/// Dim result As Status
/// result = message.Reset(i)
/// While ((Not result.IsError()) And i.HasNext())
/// result = i.Next(field)
/// If (Not result.IsError()) Then
/// ' do something on field
/// End If
/// End While
/// Return result
/// End Function
/// </code>
/// <code lang="f#">
/// F#
/// let applyToHeaderFields (message : Message) =
/// let i = new FieldIterator(FieldSelectorChoice.selectHeaderFields);
/// let field = new Field();
/// let result = message.Reset(i);
/// let IsError = result.IsError()
/// let hasNext = i.HasNext()
/// while not IsError &amp;&amp; hasNext do
/// let result3 = i.Next(field)
/// if( result3.IsError() ) then () // Handle Error
/// </code>
/// </example>
public ref class FieldIterator
{
private:
gmsec::FieldIterator * mImpl;
internal:
/// <summary>Get unmanaged implementation version</summary>
/// <returns>Unmanaged implementation</returns>
gmsec::FieldIterator * GetUnmanImpl();
/// <summary>Reset unmanaged implementation to null</summary>
void ResetUnmanImpl();
/// <summary>Delete old impl if present, and set unmanaged implementation to new value</summary>
void SetUnmanImpl(gmsec::FieldIterator* fieldIterator);
protected:
/// <summary>Finalizer, free memory and set objects to null</summary>
!FieldIterator();
public:
/// <summary>Initialize a FieldIterator without a selector.</summary>
FieldIterator();
/// <summary>Initialize a FieldIterator with a selector.
/// Only Fields which the selector function returns true for will be returned by the iterator.</summary>
/// <param name="fieldSelector">Field selector function pointer, only for use by C++ CLI</param>
FieldIterator(gmsec::FieldSelector fieldSelector);
/// <summary>Initialize a FieldIterator with a predefined selector choice</summary>
/// <param name="fieldSelectorChoice">enum of type of fields wanted iterated over</param>
FieldIterator(Nasa::Gmsec::Net::FieldSelectorChoice fieldSelectorChoice);
/// <summary>Destructor - cleans up the FieldIterator instance</summary>
~FieldIterator();
/// <summary>Indicates whether a Next call may be made</summary>
/// <returns>Returns true if there is a Next field.</returns>
bool HasNext();
/// <summary>Retrieves the next Field in the iteration.
/// If Next is called when there is no field to be read, an error is
/// returned with class GMSECErrorClasses::STATUS_ITERATOR_ERROR and code
/// GMSECErrorCodes::INVALID_NEXT.</summary>
/// <param name="field">Reference through which the next Field is returned.</param>
/// <returns>Returns a Status object indicating the success or failure of this call.</returns>
Status^ Next(Field^ field);
};
}
}
}
#endif // FieldIterator_h
/*
* Copyright 2007-2016 United States Government as represented by the
* Administrator of The National Aeronautics and Space Administration.
* No copyright is claimed in the United States under Title 17, U.S. Code.
* All Rights Reserved.
*/
/*
* Classification
*
* UNCLASSIFIED
*
*/
#ifndef GMSECDefs_Net
#define GMSECDefs_Net
// This is a compiler bug in thinking -1 is out of range for a signed type. This pragma disables it here.
#pragma warning( disable: 4341 )
using namespace System;
namespace Nasa
{
namespace Gmsec
{
namespace Net
{
// Forward references
ref class Connection;
/// <summary>
/// Field type identifiers
/// </summary>
public enum class GMSECTypeDefs : UInt16
{
/// <summary>field type identifier for UNSET field</summary>
UNSET = 0,
/// <summary>field type identifier for GMSEC_CHAR field</summary>
CHAR = 1,
/// <summary>field type identifier for GMSEC_BOOL field</summary>
BOOL = 2,
/// <summary>field type identifier for GMSEC_I16 field</summary>
I16 = 3,
/// <summary>field type identifier for GMSEC_U16 field</summary>
U16 = 4,
/// <summary>field type identifier for GMSEC_I32 field</summary>
I32 = 5,
/// <summary>field type identifier for GMSEC_U32 field</summary>
U32 = 6,
/// <summary>field type identifier for GMSECF32 field</summary>
F32 = 7,
/// <summary>field type identifier for GMSECF64 field</summary>
F64 = 8,
/// <summary>field type identifier for GMSECSTRING field</summary>
STRING = 9,
/// <summary>field type identifier for GMSECBLOB field</summary>
BIN = 10,
/// <summary>field type identifier for GMSECI8 field</summary>
I8 = 20,
/// <summary>field type identifier for GMSECU8 field</summary>
U8 = 21,
/// <summary>field type identifier for GMSECI64 field</summary>
I64 = 22,
/// <summary>field type identifier for GMSECU64 field</summary>
U64 = 23,
/// <summary>field type identifier for GMSECCOMPOUND field</summary>
COMPOUND = 24
};
/// <summary>GMSEC Boolean</summary>
public enum class GMSECBooleanDefs : Int16
{
/// <summary>
/// GMSEC version of true</summary>
GMSEC_TRUE_Net = 1,
/// <summary>
/// GMSEC version of false</summary>
GMSEC_FALSE_Net = 0
};
/// <summary>Tracking Field Defs</summary>
public enum class GMSECMessageTrackingFieldsDefs : System::Int16
{
/// <summary>GMSEC Tracking fields unset</summary>
UNSET = -1,
/// <summary>GMSEC Tracking fields on/true</summary>
ON = GMSECBooleanDefs::GMSEC_TRUE_Net,
/// <summary>GMSEC Tracking fields off/false</summary>
OFF = GMSECBooleanDefs::GMSEC_FALSE_Net,
};
/// <summary>Message kind identifiers</summary>
public enum class GMSECMsgKindDefs : UInt16
{
/// <summary>unset message kind</summary>
UNSET = 0,
/// <summary>publish message kind</summary>
PUBLISH = 1,
/// <summary>request message kind</summary>
REQUEST = 2,
/// <summary>reply message kind</summary>
REPLY = 3
};
/// <summary>Special timeout values</summary>
public enum class GMSECWaitDefs
{
/// <summary>timeout "no wait" constant - causes methods with timeouts to not block</summary>
/// <seealso cref="Connection::Request(Nasa::Gmsec::Net::Message ^ request_msg, Int32 timeout, Nasa::Gmsec::Net::ReplyCallback ^ rcb, Int32 republish_ms)" />
/// <seealso cref="Connection::Request(Nasa::Gmsec::Net::Message ^ request_msg, Int32 timeout, [Runtime::InteropServices::Out] Nasa::Gmsec::Net::Message ^ %reply_msg, Int32 republish_ms)" />
/// <seealso cref="Connection::GetNextMsg([Out] Nasa::Gmsec::Net::Message ^ %msg, Int32 timeout)" />
NO_WAIT = 0,
/// <summary>timeout "wait forever" constant - causes methods with timeouts to block</summary>
/// <seealso cref="Connection::Request(Nasa::Gmsec::Net::Message ^ request_msg, Int32 timeout, Nasa::Gmsec::Net::ReplyCallback ^ rcb, Int32 republish_ms)" />
/// <seealso cref="Connection::Request(Nasa::Gmsec::Net::Message ^ request_msg, Int32 timeout, [Runtime::InteropServices::Out] Nasa::Gmsec::Net::Message ^ %reply_msg, Int32 republish_ms)" />
/// <seealso cref="Connection::GetNextMsg([Out] Nasa::Gmsec::Net::Message ^ %msg, Int32 timeout)" />
WAIT_FOREVER = -1
};
}
}
}
#endif // GMSECDefs_Net
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment