=encoding utf8

=head1 NAME

SPVM::Document::ExchangeAPI - Exchange API

=head1 What is Exchange API

Exchange API is perl functions to exchange Perl data to SPVM data, and reverse.
  
  use SPVM 'SomeModule';
  
  # Convert Perl array reference to SPVM int array
  my $spvm_nums = SPVM::new_iarray([1, 2, 3]);
  
  # Convert SPVM int array to Perl array reference
  my $nums = $spvm_nums->to_elems;
  
  # Create SPVM object(SomeModule need to define new method)
  my $spvm_object = SomeModule->new;

=head1 Functions

=head2 new_barray

  my $spvm_array = SPVM::new_barray([1, 2, 3]);

Convert Perl array reference to SPVM byte array.

Return value is L<SPVM::Data::Array> object.

=head2 new_sarray

  my $spvm_array = SPVM::new_sarray([1, 2, 3]);

Convert Perl array reference to SPVM short array.

Return value is L<SPVM::Data::Array> object.

=head2 new_iarray

  my $spvm_array = SPVM::new_iarray([1, 2, 3]);

Convert Perl array reference to SPVM int array.

Return value is L<SPVM::Data::Array> object.

=head2 new_larray

  my $spvm_array = SPVM::new_larray([1, 2, 3]);

Convert Perl array reference to SPVM long array.

Return value is L<SPVM::Data::Array> object.

=head2 new_farray

  my $spvm_array = SPVM::new_farray([0.5, 0.1, 0.3]);

Convert Perl array reference to SPVM float array.

Return value is L<SPVM::Data::Array> object.

=head2 new_darray

  my $spvm_array = SPVM::new_darray([0.5, 0.1, 0.3]);

Return value is L<SPVM::Data::Array> object.

=head2 new_oarray

  my $array = SPVM::new_oarray("TestCase", [$object1, $object2]);

Convert Perl array reference which contains SPVM object to SPVM object array.

Return value is L<SPVM::Data::Array> object.

An example:
  
  use SPVM 'Point';
  my $spvm_point1 = Point->new(0, 1);
  my $spvm_point2 = Point->new(3, 4);
  my $spvm_points = SPVM::new_oarray("Point", [$spvm_point1, $spvm_point2]);
