Actual serialization of self to serializer

This writes the full data of self to serializer.

This method can be redefined in sub classes and refinements. It should use Serializer::serialize_attribute to to register real or logical attributes.

Any refinement should have its equivalent refinement of Deserializer::deserialize_class to support this custom deserialization.

Property definitions

serialization $ Serializable :: core_serialize_to
	# Actual serialization of `self` to `serializer`
	#
	# This writes the full data of `self` to `serializer`.
	#
	# This method can be redefined in sub classes and refinements.
	# It should use `Serializer::serialize_attribute` to to register real or
	# logical attributes.
	#
	# Any refinement should have its equivalent refinement of
	# `Deserializer::deserialize_class` to support this custom deserialization.
	fun core_serialize_to(serializer: Serializer) do end
lib/serialization/serialization_core.nit:226,2--236,53

a_star $ Node :: core_serialize_to
	# We customize the serialization process to avoid problems with recursive
	# serialization engines. These engines, such as `JsonSerializer`,
	# are at danger to serialize the graph as a very deep tree.
	# With a large graph it can cause a stack overflow.
	#
	# Instead, we serialize the nodes first and then the links.
	redef fun core_serialize_to(serializer)
	do
		serializer.serialize_attribute("graph", graph)
	end
lib/a_star/a_star.nit:199,2--208,4

a_star $ Graph :: core_serialize_to
	redef fun core_serialize_to(serializer)
	do
		serializer.serialize_attribute("nodes", nodes)
		serializer.serialize_attribute("links", links)
	end
lib/a_star/a_star.nit:276,2--280,4

a_star $ TargetCondition :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

geometry :: points_and_lines $ Deserializer :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

noise :: noise $ Deserializer :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

bucketed_game :: bucketed_game $ Deserializer :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

serialization :: serialization_core $ Error :: core_serialize_to
	redef fun core_serialize_to(v)
	do
		v.serialize_attribute("message", message)
		v.serialize_attribute("cause", cause)
	end
lib/serialization/serialization_core.nit:317,2--321,4

serialization :: serialization_core $ Couple :: core_serialize_to
	redef fun core_serialize_to(v)
	do
		v.serialize_attribute("first", first)
		v.serialize_attribute("second", second)
	end
lib/serialization/serialization_core.nit:279,2--283,4

poset $ POSetElement :: core_serialize_to
	redef fun core_serialize_to(serializer)
	do
		serializer.serialize_attribute("poset", poset)
		serializer.serialize_attribute("element", element)
		serializer.serialize_attribute("tos", tos)
		serializer.serialize_attribute("froms", froms)
		serializer.serialize_attribute("dtos", dtos)
		serializer.serialize_attribute("dfroms", dfroms)
		serializer.serialize_attribute("count", count)

		# Don't serialize `froms`, `dtos` and `tos` as they duplicate information.
		# TODO serialize them if a flag for extra info is set on `serializer`.
	end
lib/poset/poset.nit:643,2--655,4

bucketed_game $ Turnable :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

bucketed_game $ GameEvent :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

noise $ ImprovedNoise :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
	v.serialize_attribute("p", p)
end
2,1--6,3

popcorn $ ValidationResult :: core_serialize_to
	redef fun core_serialize_to(v) do
		var errors = new JsonObject
		for k, e in self.errors do
			errors[k] = new JsonArray.from(e)
		end
		v.serialize_attribute("has_error", has_error)
		v.serialize_attribute("errors", errors)
	end
lib/popcorn/pop_validation.nit:142,2--149,4

a_star $ ConstantPathContext :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

serialization :: serialization_core $ Ref :: core_serialize_to
	redef fun core_serialize_to(v)
	do
		v.serialize_attribute("item", first)
	end
lib/serialization/serialization_core.nit:296,2--299,4

bucketed_game $ FirstTurnEvent :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

geometry $ IPoint :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

geometry $ ILine :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

nitcorn $ MyOtherData :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
	v.serialize_attribute("i", i)
end
2,1--6,3

noise $ InterpolatedNoise :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

serialization $ A :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
	v.serialize_attribute("i", i)
end
2,1--6,3

serialization $ B :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
	v.serialize_attribute("a", a)
end
2,1--6,3

poset $ POSet :: core_serialize_to
	redef fun core_serialize_to(serializer)
	do
		# Optimize written data because this structure has duplicated data
		# For example, serializing the class hierarchy of a simple program where E is String
		# result is before: 200k, after: 56k.
		serializer.serialize_attribute("elements", elements)
	end
lib/poset/poset.nit:491,2--497,4

geometry $ IPoint3d :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

geometry $ ILine3d :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

noise :: noise $ Float :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

serialization :: serialization_core $ ProxyQueue :: core_serialize_to
	redef fun core_serialize_to(v) do v.serialize_attribute("seq", seq)
lib/serialization/serialization_core.nit:342,2--68

serialization :: serialization_core $ RandQueue :: core_serialize_to
	redef fun core_serialize_to(v) do v.serialize_attribute("seq", seq)
lib/serialization/serialization_core.nit:360,2--68

serialization :: serialization_core $ MinHeap :: core_serialize_to
	redef fun core_serialize_to(v)
	do
		v.serialize_attribute("items", items)
		v.serialize_attribute("comparator", comparator)
	end
lib/serialization/serialization_core.nit:385,2--389,4

more_collections $ MultiHashMap :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

geometry $ Point3d :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
	v.serialize_attribute("z", z)
end
2,1--6,3

geometry $ Line3d :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3

noise :: noise $ Int :: core_serialize_to
redef fun core_serialize_to(v)
do
	super
end
2,1--5,3