示例#1
0
文件: hkl-vector.c 项目: picca/hkl
/**
 * hkl_vector_dup: (skip)
 * @self: the HklVector to copy
 *
 * Copy an HklVector
 *
 * Returns: A copy of self which need to be free using hkl_vector_free
 **/
HklVector* hkl_vector_dup (const HklVector* self) {
        HklVector* dup;

	dup = HKL_MALLOC(HklVector);
        memcpy(dup, self, sizeof (HklVector));
        return dup;
}
示例#2
0
HklPseudoAxisEngineModePsi *hkl_pseudo_axis_engine_mode_psi_new(char const *name,
								size_t axes_names_len,
								char const *axes_names[])
{
	HklPseudoAxisEngineModePsi *self;
	HklParameter parameters[3];
	HklFunction functions[] = {psi_func};

	if (axes_names_len != 4){
		fprintf(stderr, "This generic HklPseudoAxisEngineModePsi need exactly 4 axes");
		exit(128);
	}

	self = HKL_MALLOC(HklPseudoAxisEngineModePsi);

	/* h1  */
	hkl_parameter_init(&parameters[0],
			   "h1",
			   -1, 1, 1,
			   HKL_TRUE, HKL_FALSE,
			   NULL, NULL);

	/* k1 */
	hkl_parameter_init(&parameters[1],
			   "k1",
			   -1, 0, 1,
			   HKL_TRUE, HKL_FALSE,
			   NULL, NULL);

	/* l1 */
	hkl_parameter_init(&parameters[2],
			   "l1",
			   -1, 0, 1,
			   HKL_TRUE, HKL_FALSE,
			   NULL, NULL);

	/* the base constructor; */
	hkl_pseudo_axis_engine_mode_init(&self->parent,
					 name,
					 hkl_pseudo_axis_engine_mode_init_psi_real,
					 hkl_pseudo_axis_engine_mode_get_psi_real,
					 hkl_pseudo_axis_engine_mode_set_real,
					 1, functions,
					 3, parameters,
					 axes_names_len, axes_names);


	return self;
}