Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace kwiver::vital::any with std::any (C++17) #1701

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion arrows/core/metadata_map_io_csv.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

#include "metadata_map_io_csv.h"

#include <vital/any.h>
#include <vital/exceptions/algorithm.h>
#include <vital/exceptions/io.h>
#include <vital/types/geo_point.h>
Expand Down
8 changes: 4 additions & 4 deletions arrows/klv/klv_value.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ class klv_value::internal_base
virtual bool equal_to( internal_base const& rhs ) const = 0;
virtual std::ostream& print( std::ostream& os ) const = 0;
virtual internal_base* clone() const = 0;
virtual kwiver::vital::any to_any() const = 0;
virtual std::any to_any() const = 0;
};

// ----------------------------------------------------------------------------
Expand Down Expand Up @@ -145,7 +145,7 @@ class klv_value::internal_ : public internal_base
return new internal_< T >{ m_item };
}

kwiver::vital::any
std::any
to_any() const override final
{
return m_item;
Expand Down Expand Up @@ -213,11 +213,11 @@ ::operator=( T&& rhs )
}

// ----------------------------------------------------------------------------
kwiver::vital::any
std::any
klv_value
::to_any() const
{
return m_item ? m_item->to_any() : kwiver::vital::any{};
return m_item ? m_item->to_any() : std::any{};
}

// ----------------------------------------------------------------------------
Expand Down
10 changes: 5 additions & 5 deletions arrows/klv/klv_value.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
#include <arrows/klv/klv_blob.h>
#include <arrows/klv/kwiver_algo_klv_export.h>

#include <vital/any.h>

#include <any>
#include <memory>
#include <sstream>

#ifndef KWIVER_ARROWS_KLV_KLV_VALUE_H_
Expand Down Expand Up @@ -41,7 +41,7 @@ class KWIVER_ALGO_KLV_EXPORT klv_bad_value_cast : public std::bad_cast
// ----------------------------------------------------------------------------
/// Type-erased container class for the values of KLV fields.
///
/// It is necessary for this class to exist separately from kwiver::vital::any
/// It is necessary for this class to exist separately from std::any
/// to enforce that all contained values support comparison and stringstream
/// operations. It also contains an optional embedded byte count - for some KLV
/// data formats, the length can vary to reflect the precision of the numerical
Expand All @@ -57,7 +57,7 @@ class KWIVER_ALGO_KLV_EXPORT klv_value
!std::is_same< typename std::decay< T >::type,
klv_value >::value &&
!std::is_same< typename std::decay< T >::type,
kwiver::vital::any >::value >::type >
std::any >::value >::type >
klv_value( T&& value );

klv_value( klv_value const& other );
Expand All @@ -81,7 +81,7 @@ class KWIVER_ALGO_KLV_EXPORT klv_value
swap( klv_value& rhs ) noexcept;

/// Create an \c any object with a copy of this value.
kwiver::vital::any
std::any
to_any() const;

/// Check if the object contains no value.
Expand Down
8 changes: 4 additions & 4 deletions arrows/serialize/json/activity.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ activity::
// ----------------------------------------------------------------------------
std::shared_ptr< std::string >
activity::
serialize( const kwiver::vital::any& element )
serialize( const std::any& element )
{
kwiver::vital::activity l_activity =
kwiver::vital::any_cast< kwiver::vital::activity > ( element );
std::std::any_cast< kwiver::vital::activity > ( element );

std::stringstream msg;
msg << "activity ";
Expand All @@ -46,7 +46,7 @@ serialize( const kwiver::vital::any& element )
}

// ----------------------------------------------------------------------------
kwiver::vital::any activity::
std::any activity::
deserialize( const std::string& message )
{
std::stringstream msg(message);
Expand All @@ -65,7 +65,7 @@ deserialize( const std::string& message )
load( ar, l_activity );
}

return kwiver::vital::any( l_activity );
return std::any( l_activity );
}

} } } }
4 changes: 2 additions & 2 deletions arrows/serialize/json/activity.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class KWIVER_SERIALIZE_JSON_EXPORT activity
virtual ~activity();

std::shared_ptr< std::string >
serialize( const kwiver::vital::any& element ) override;
kwiver::vital::any deserialize( const std::string& message ) override;
serialize( const std::any& element ) override;
std::any deserialize( const std::string& message ) override;
};

} } } }
Expand Down
8 changes: 4 additions & 4 deletions arrows/serialize/json/activity_type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ activity_type::
// ----------------------------------------------------------------------------
std::shared_ptr< std::string >
activity_type::
serialize( const kwiver::vital::any& element )
serialize( const std::any& element )
{
kwiver::vital::activity_type at =
kwiver::vital::any_cast< kwiver::vital::activity_type > ( element );
std::std::any_cast< kwiver::vital::activity_type > ( element );

std::stringstream msg;
msg << "activity_type ";
Expand All @@ -46,7 +46,7 @@ serialize( const kwiver::vital::any& element )
}

// ----------------------------------------------------------------------------
kwiver::vital::any activity_type::
std::any activity_type::
deserialize( const std::string& message )
{
std::stringstream msg(message);
Expand All @@ -65,7 +65,7 @@ deserialize( const std::string& message )
load( ar, at );
}

return kwiver::vital::any(at);
return std::any(at);
}

} } } }
4 changes: 2 additions & 2 deletions arrows/serialize/json/activity_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class KWIVER_SERIALIZE_JSON_EXPORT activity_type
virtual ~activity_type();

std::shared_ptr< std::string >
serialize( const kwiver::vital::any& element ) override;
kwiver::vital::any deserialize( const std::string& message ) override;
serialize( const std::any& element ) override;
std::any deserialize( const std::string& message ) override;
};

} } } }
Expand Down
8 changes: 4 additions & 4 deletions arrows/serialize/json/bounding_box.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ bounding_box::
// ----------------------------------------------------------------------------
std::shared_ptr< std::string >
bounding_box::
serialize( const vital::any& element )
serialize( const std::any& element )
{
kwiver::vital::bounding_box_d bbox =
kwiver::vital::any_cast< kwiver::vital::bounding_box_d > ( element );
std::std::any_cast< kwiver::vital::bounding_box_d > ( element );

std::stringstream msg;
msg << "bounding_box "; // add type tag
Expand All @@ -44,7 +44,7 @@ serialize( const vital::any& element )
}

// ----------------------------------------------------------------------------
vital::any bounding_box::
std::any bounding_box::
deserialize( const std::string& message )
{
std::stringstream msg(message);
Expand All @@ -63,7 +63,7 @@ deserialize( const std::string& message )
load( ar, bbox );
}

return kwiver::vital::any(bbox);
return std::any(bbox);
}

} } } } // end namespace kwiver
4 changes: 2 additions & 2 deletions arrows/serialize/json/bounding_box.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class KWIVER_SERIALIZE_JSON_EXPORT bounding_box
bounding_box();
virtual ~bounding_box();

std::shared_ptr< std::string > serialize( const vital::any& elements ) override;
vital::any deserialize( const std::string& message ) override;
std::shared_ptr< std::string > serialize( const std::any& elements ) override;
std::any deserialize( const std::string& message ) override;
};

} } } } // end namespace kwiver
Expand Down
8 changes: 4 additions & 4 deletions arrows/serialize/json/detected_object.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ detected_object::
// ----------------------------------------------------------------------------
std::shared_ptr< std::string >
detected_object::
serialize( const vital::any& element )
serialize( const std::any& element )
{
// Get native data type from any
kwiver::vital::detected_object_sptr obj =
kwiver::vital::any_cast< kwiver::vital::detected_object_sptr > ( element );
std::std::any_cast< kwiver::vital::detected_object_sptr > ( element );

std::stringstream msg;
msg << "detected_object ";
Expand All @@ -48,7 +48,7 @@ serialize( const vital::any& element )
}

// ----------------------------------------------------------------------------
vital::any detected_object::
std::any detected_object::
deserialize( const std::string& message )
{
std::stringstream msg(message);
Expand All @@ -68,7 +68,7 @@ deserialize( const std::string& message )
load( ar, *obj );
}

return kwiver::vital::any(obj);
return std::any(obj);
}

} } } } // end namespace kwiver
4 changes: 2 additions & 2 deletions arrows/serialize/json/detected_object.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class KWIVER_SERIALIZE_JSON_EXPORT detected_object
detected_object();
virtual ~detected_object();

std::shared_ptr< std::string > serialize( const vital::any& elements ) override;
vital::any deserialize( const std::string& message ) override;
std::shared_ptr< std::string > serialize( const std::any& elements ) override;
std::any deserialize( const std::string& message ) override;
};

} } } } // end namespace kwiver
Expand Down
8 changes: 4 additions & 4 deletions arrows/serialize/json/detected_object_set.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ detected_object_set::
// ----------------------------------------------------------------------------
std::shared_ptr< std::string >
detected_object_set::
serialize( const vital::any& element )
serialize( const std::any& element )
{
kwiver::vital::detected_object_set_sptr obj =
kwiver::vital::any_cast< kwiver::vital::detected_object_set_sptr > ( element );
std::std::any_cast< kwiver::vital::detected_object_set_sptr > ( element );

std::stringstream msg;
msg << "detected_object_set ";
Expand All @@ -48,7 +48,7 @@ serialize( const vital::any& element )
}

// ----------------------------------------------------------------------------
vital::any detected_object_set::
std::any detected_object_set::
deserialize( const std::string& message )
{
std::stringstream msg(message);
Expand All @@ -68,7 +68,7 @@ deserialize( const std::string& message )
load( ar, *obj );
}

return kwiver::vital::any( kwiver::vital::detected_object_set_sptr( obj ) );
return std::any( kwiver::vital::detected_object_set_sptr( obj ) );
}

} } } } // end namespace kwiver
4 changes: 2 additions & 2 deletions arrows/serialize/json/detected_object_set.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class KWIVER_SERIALIZE_JSON_EXPORT detected_object_set
detected_object_set();
virtual ~detected_object_set();

std::shared_ptr< std::string > serialize( const vital::any& element ) override;
vital::any deserialize( const std::string& message ) override;
std::shared_ptr< std::string > serialize( const std::any& element ) override;
std::any deserialize( const std::string& message ) override;
};

} } } } // end namespace kwiver
Expand Down
8 changes: 4 additions & 4 deletions arrows/serialize/json/detected_object_type.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ detected_object_type::
// ----------------------------------------------------------------------------
std::shared_ptr< std::string >
detected_object_type::
serialize( const vital::any& element )
serialize( const std::any& element )
{
kwiver::vital::detected_object_type dot =
kwiver::vital::any_cast< kwiver::vital::detected_object_type > ( element );
std::std::any_cast< kwiver::vital::detected_object_type > ( element );

std::stringstream msg;
msg << "detected_object_type ";
Expand All @@ -44,7 +44,7 @@ serialize( const vital::any& element )
}

// ----------------------------------------------------------------------------
vital::any detected_object_type::
std::any detected_object_type::
deserialize( const std::string& message )
{
std::stringstream msg(message);
Expand All @@ -63,7 +63,7 @@ deserialize( const std::string& message )
load( ar, dot );
}

return kwiver::vital::any(dot);
return std::any(dot);
}

} } } } // end namespace kwiver
4 changes: 2 additions & 2 deletions arrows/serialize/json/detected_object_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ class KWIVER_SERIALIZE_JSON_EXPORT detected_object_type
detected_object_type();
virtual ~detected_object_type();

std::shared_ptr< std::string > serialize( const vital::any& element ) override;
vital::any deserialize( const std::string& message ) override;
std::shared_ptr< std::string > serialize( const std::any& element ) override;
std::any deserialize( const std::string& message ) override;
};

} } } } // end namespace kwiver
Expand Down
8 changes: 4 additions & 4 deletions arrows/serialize/json/image.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ image::
// ----------------------------------------------------------------------------
std::shared_ptr< std::string >
image::
serialize( const vital::any& element )
serialize( const std::any& element )
{
// Get native data type from any
kwiver::vital::image_container_sptr obj =
kwiver::vital::any_cast< kwiver::vital::image_container_sptr > ( element );
std::std::any_cast< kwiver::vital::image_container_sptr > ( element );

std::stringstream msg;
msg << "image ";
Expand All @@ -48,7 +48,7 @@ serialize( const vital::any& element )
}

// ----------------------------------------------------------------------------
vital::any
std::any
image::
deserialize( const std::string& message )
{
Expand All @@ -69,7 +69,7 @@ deserialize( const std::string& message )
load( ar, img_ctr_sptr );
}

return kwiver::vital::any( img_ctr_sptr );
return std::any( img_ctr_sptr );
}

} } } } // end namespace kwiver
4 changes: 2 additions & 2 deletions arrows/serialize/json/image.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class KWIVER_SERIALIZE_JSON_EXPORT image
image();
virtual ~image();

std::shared_ptr< std::string > serialize( const vital::any& element ) override;
vital::any deserialize( const std::string& message ) override;
std::shared_ptr< std::string > serialize( const std::any& element ) override;
std::any deserialize( const std::string& message ) override;
};

} } } } // end namespace kwiver
Expand Down
Loading